Hi;
If I do in classes;
class class1;
class class2;
and I make in (class class1) Composite Objects from class class2;.
class class1
{ private:
class2 ** PointerClass2;
public:
PointerClass2 = new class2*[size];
// so I need to put deconstructor to delete (the pointer dynamic memory location)
~ class1 ()
{
delete [] PointerClass2;
PointerClass2 = NULL;
}
}
I understand up code;
but if the compilare do the deconstructor, it go to deconstructor of class2 ,
and class2 don't has ( in data member its) any pointer dynamic memory which need to "delete it".
So;
What do you think of the correct body of deconstructor ( which
must contain .)?
Have you got any idea ?
I have make a lot of tries but with no success ....