#include <iostream>
using namespace std; 
class base 
{
    public :
    int x; 
    void getdata()
    {
        cout <<"Enter the value of x:";
        cin>>x; 
        cout <<x<<endl; 
    }
};
class derive1 :public base 
{
    public :
    int y; 
    void readdata()
    {
        cout <<"Enter the value of y: ";
        cin>>y; 
        cout <<y<<endl; 
    }
};
class derive2 : public derive1
{
    public :
    int z; 
    void indata ()
    {
        cout <<"Enter the value of z: ";
        cin>>z; 
        cout <<z<<endl; 
    }
    void product ()
    {
        cout <<"product ="<<x*y*z<<endl; 
    }
};
int main() {
    derive2 m; 
    m. getdata();
    m. readdata();
    m. indata();
    m. product ();
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: