//Write a Program to show Concept of virtual function

| |


#include<iostream.h>
#include<conio.h>
class base
{ public:
virtual void display();
};
class derived:public base
{ public:
void display();
};
void base::display()
{cout<<"\n Virtual function of base class"<<endl;
}
void derived::display()
{
cout<<"\n Ordinary Function of derived clas"<<endl;
}
void main()
{ clrscr();
class base*ptr;
class derived obj;
ptr=&obj;
ptr->display();
getch();
}
<