#include
#include
class base1
{
protected:
int x;
public:
void showx()
{
cout<
};
class base2
{
protected:
int y;
public:
void showy()
{
cout<
};
//INHERIT MULTIPLE BASE CLASSES
class derived:public base1, public base2
{
public:
void set(int i,int j)
{
x=i;
y=j;
}
};
int main()
{
clrscr();
derived ob;
ob.set(10,20); //PROVIDED BY DERIVED
ob.showx(); //FROM BASE1
ob.showy(); //FROM BASE2
getch();
return 0;
}
OUTPUT:
10
20
No comments:
Post a Comment