Program of VIRTUAL Base class

/*Program of VIRTUAL base class*/

class A
cout<<‚ÄĚThis is class A\n"; } }; class B:virtual public A { public: B() { cout <<"This is class B\n"; } }; class C:virtual public A { public: C() { cout<<"This is class C\n"; } }; class D:public C,public B { public: D() { cout<OUTPUT :
This is class A
This is class B
This is class C
This is class D

Leave a Reply

Your email address will not be published. Required fields are marked *