#include <iostream>
using namespace std;
class Base {
public:
virtual void show_message(void) { cout << "This is the base class\n"; };
};
class Derived: public Base
{
public:
virtual void show_message(void) { cout << "This is the derived class\n" ; };
};
int main(void){
Base *base_pointer = new Base;
base_pointer->show_message();
base_pointer = new Derived;
base_pointer->show_message();
}
|