Cod 12 P3

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

class A

{
protected:

int a;

public:

A(){ cout<<" constructor A "<<endl; }

A(int a):a(a){ }

~A(){ cout<<" destructor A "<<endl; }

void mA(){ cout<<" metoda A "<<endl; }

void showA(){ cout<<" a= "<<this->a; }

};

class B : public A
{
protected:

int b;

public:

B(){ cout<<" constructor B "<<endl; }

B(int b, int a):b(b),A(a){ }

~B(){ cout<<" destructor B "<<endl; }

void mB(){ cout<<" metoda B "<<endl; }

void showB(){ cout<<" b= "<<this->b; }

};

class C : public B
{
protected:

int c;

public:

C(){ cout<<" constructor C "<<endl;


this->mA();
this->mB();
}

C( int a, int b, int c):c(c),B( b , a ){}


~C(){ cout<<" destructor C "<<endl;
this->mA();
this->mB();
}

void mC(){ cout<<" metoda C "<<endl; }


void showC(){ cout<<" c= "<<this->c; }
};

You might also like