#include<iostream>
using namespace std;
class M
{
protected :
int m;
public:
void get_m(int x);
void show_m();
};
void M::get_m(int x)
{
m=x;
}
void M::show_m()
{
cout<<“The value of m = “<<m<<“\n”;
}
class N
{
protected:
int n;
public:
void get_n(int y);
void show_n();
};
void N::get_n(int y)
{
n=y;
}
void N::show_n()
{
cout<<“The value of n =”<<n<<“\n”;
}
class P:public M,public N
{
protected:
int mul;
public:
void multiply();
void show();
};
void P::multiply()
{
mul=m*n;
}
void P::show()
{
cout<<“The result of multiplication = “<<mul<<“\n”;
}
int main()
{
P p;
p.get_m(23);
p.get_n(60);
p.show_m();
p.show_n();
p.multiply();
p.show();
}
Output:
The value of m=23
The value of n=60
The result of multiplication is 1380