#include<iostream>
using namespace std;

class parent
{
   protected:
    int x;
    public:
    parent(int i)
    {
        x = i;
        cout << "Parent class Constructor\n";
    }
    ~parent()
    {
        cout << "Parent class destructor\n";
    }
};

class child: public parent
{

    int y;
    public:
    child(int i,int j) : parent(i)  
    {
        y = j;
        cout << "Child class Constructor\n";
    }
    ~child()
    {
        cout << "Child class destructor\n";
    }
    void show()
    {
    cout<<"x= "<<x<<endl<<"y= "<<y<<endl;
    }
};
int main()
{
    child c(10,20);
    c.show();
}



     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Parent class Constructor
Child class Constructor
x= 10
y= 20
Child class destructor
Parent class destructor