//Sample Program to demonstrate the concept of Pure Virtual function
#include < iostream.h >
#include < conio.h >

class A{
   virtual void display()=0;
   };
   class B:public A
   {
   int j;
   public:
   void set()
   {
   j=66;
   }
   void display()
   {
   cout << "\n\n j is : " << j;
   }
   };
   class C:public A
   {
   int m,n;
   public:
   void set(){m=23;n=33;}
   void display()
   {
   cout << "\n\n m is : " << m << "  n is : " << n;
   }
   };
   void main()
    {
    class B b1;
    class C c1;
    clrscr();
    b1.set();
    b1.display();
    c1.set();
    c1.display();
    getch();
    }
Click here to go back.

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus






Footer1