/*PROGRAM TO SHOW THE CONCEPT OF VIRTUAL BASE CLASS*/
#include<conio.h>
#include<iostream.h>
class A
{
int a;
public:
void get_a()
{
cout<<“Enter a: “;
cin>>a;
cout<<“a= “<<a;
}
};
class B:public virtual A
{
int b;
public:
void get_b()
{
cout<<“\nEnter b: “;
cin>>b;
cout<<“b= “<<b<<endl;
}
};
class C:public virtual A
{
int c;
public:
void get_c()
{
cout<<“Enter c: “;
cin>>c;
cout<<“c= “<<c<<endl;
}
};
class D:public B,public C
{
int d;
public:
void get_d()
{
cout<<“Enter d: “;
cin>>d;
cout<<“d= “<<d<<endl;
}
};
void main()
{
D d1;
clrscr();
d1.get_a();
d1.get_b();
d1.get_c();
d1.get_d();
getch();
}