#include<iostream>
using namespace std;
class base
{
public:
void virtual show()
{
cout<<“baseclass”;
}
};
class derived:public base
{
public:
void show()
{
cout<<“derived class”;
}
};
int main()
{
base *b;
derived d;
b=&d;
b->show();
return(0);
}
Output:
Derived class