Multiple Inheritance Program

Output


Program:

#include<iostream.h>
#include<conio.h>
class sample
{
private:
int a,b;
public:
void getdata(int x,int y)
{
a=x;
b=y;
}
void display()
{
int sum=a+b;
cout<<"**** Multiple Inheritance Example ****"<<endl<<endl;
cout<<"The sum is ="<<sum<<endl;
}
};
class test
{
public:
void show()
{
cout<<"This is the second class"<<endl;
}
};
class final:public sample,public test
{
public:
void showdata()
{
cout<<"This is the Multiple Inheritance Class"<<endl;
}
};
void main()
{
clrscr();
final f;
f.getdata(10,10);
f.display();
f.show();
f.showdata();
getch();
}

2 comments:

Program:- #include<stdio.h> #include<conio.h> #include<graphics.h> void main() { int a=2; clrscr(); ...

GET UP TO 70% OFF