G
Gerhard Wolfstieg
The following situation:
class A0
{ static A0 *a0; // something like this to publish the pointer
public:
A0()
{ a0 = this;
}
virtual ~A0(){}
};
A0::a0;
class A : public A0 { public: virtual ~A(){} };
class B { public: virtual ~B(){} };
class XYZ : public A, public B { public: virtual ~XYZ(){} };
int
main( int, char ** )
{ XYZ *xyz = new XYZ();
// ...
delete A0::a0;
}
I expected to have deleted xyz at the end of main. It does not and that is
the problem. What can I expect following the standard or what have I to do
to have called the xyz dtor?
I cannot find any hints in my books.
Thank you, Gerhard Wolfsieg
class A0
{ static A0 *a0; // something like this to publish the pointer
public:
A0()
{ a0 = this;
}
virtual ~A0(){}
};
A0::a0;
class A : public A0 { public: virtual ~A(){} };
class B { public: virtual ~B(){} };
class XYZ : public A, public B { public: virtual ~XYZ(){} };
int
main( int, char ** )
{ XYZ *xyz = new XYZ();
// ...
delete A0::a0;
}
I expected to have deleted xyz at the end of main. It does not and that is
the problem. What can I expect following the standard or what have I to do
to have called the xyz dtor?
I cannot find any hints in my books.
Thank you, Gerhard Wolfsieg