#include <iostream>
using namespace std;
class base
{
public:
int x;
void getdata()
{
cout<<"The value of x : ";
cin>>x;
}
};
class derive1:public base
{
public:
int y;
void readdata()
{
cout<<"\nThe value of y : ";
cin>>y;
}
};
class derive2:public derive1
{
int z;
public:
void indata()
{
cout<<"\nThe value of z :";
cin>>z;
}
void product()
{
cout<<"\nThe value of x is "<<x;
cout<<"\nThe value of y is "<<y;
cout<<"\nThe value of z is "<<z;
cout<<"\nThe product is "<<x*y*z;
}
};
int main()
{
derive2 d;
d.getdata();
d.readdata();
d.indata();
d.product();
}
To embed this project on your website, copy the following code and paste it into your website's HTML: