"Ian" <no***@nowhere.com> wrote in message
news:40**************@nowhere.com...
Given
struct A{...};
struct B{...};
struct C : public A, public B {...}
int main()
{
A* a = new C;
delete a;
return 0;
}
Will the B part of a be correctly deleted?
Ian
Its not a question of whether or not the B part will be correctly deleted.
Its a question of whether the code is correct or not, if it is not the
consequences are undefined.
The answer is that the code is correct if A has a virtual destructor,
otherwise you have undefined behaviour.
john