Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Multiple Inheritance in C++

#include<iostream.h>
#include<conio.h>
int m,n;
class M
{
public:
void get1(int);
};
class N
{
public:
void get2(int);
};
class P:public M,public N
{
public:
void display();
};
void M :: get1(int x)
{
m=x;
}
void N :: get2(int y)
{
n=y;
}
void P:: display()
{
cout<<"m="<<m<<"\tn="<<n<<"\tm*n="<<m*n;
}
void main()
{
clrscr();
P s;
s.get1(10);
s.get2(20);
s.display();
getch();
}