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