#include<iostream.h>
#include<conio.h>
class Base
{
public:
virtual void
display()
{
cout<<"This
is base class display function\n";
}
};
class
Derived: public Base
{
public:
void
display()
{
cout<<"This
is Derived class display function\n";
}
};
void main()
{
clrscr();
Base *ptr;
Derived obj;
ptr=&obj;
ptr->display();
getch();
}
Output