/*PROGRAM TO IMPLEMENT MULTIPLE INHERITANCE BY USING PRIVATE AND PROTECTED VISIBILITY MODE*/
#include<conio.h>
#include<iostream.h>
class base1
{
char name[15];
int age;
public:
base1()
{
cout<<“Enter name: “;
cin>>name;
cout<<“Enter age: “;
cin>>age;
}
void show1()
{
cout<<“Name is: “<<name<<endl;
cout<<“age is: “<<age<<endl;
}
~base1()
{
cout<<“Destructor of first base class is executed”<<endl;
}
};
class base2
{
float salary;
char des[5];
public:
base2()
{
cout<<“Enter salary: “;
cin>>salary;
cout<<“Enter designation: “;
cin>>des;
}
void show2()
{
cout<<“Salary is: “<<salary<<endl;
cout<<“Designation is: “<<des<<endl;
}
~base2()
{
cout<<“Destructor of second base class is executed”<<endl;
}
};
class derived:private base1,protected base2
{
public:
derived():base1(),base2()
{
}
void show3()
{
show1();
show2();
}
~derived()
{
cout<<“Destructor of derived class is executed”<<endl;
}
};
void main()
{
clrscr();
{
derived d;
d.show3();
}
getch();
}