#include <iostream> 
#include <string>      
using namespace std;

class MyShape
{
public:
	int i;
	MyShape(int param)
	{
		i = param;
		cout << 1 << endl;
	}
	~MyShape()
	{
		cout << 6 << endl;
	}
};
class MySize
{
public:
	int j;
	MySize(int param)
	{
		j = param;
		cout << 2 << endl;
	}
	~MySize()
	{
		cout << 5 << endl;
	}
};
class MyRectangle
{
public:
	MyShape p;
	MySize  z;
	MyRectangle() : p(100), z(200) //if there are'nt any parameter for MyShape and MySize classes this call of constructor no necessary
	{
		cout << 3 << endl;
	}
	~MyRectangle()
	{
		cout << 4 << endl;
	}
};

int main()
{
	MyRectangle R2;
	cout << "R2.p.i = " << R2.p.i << endl;
	cout << "R2.z.i = " << R2.z.j << endl;
}

