Say I have two base classes,
struct A {};
struct B {};
and a derived one that uses multiple inheritance
struct D : A, B {};
If my use scenario goes something like this:
A *obj = new D;
i.e. I'll never use the B
base class to refer to the derived object, do I have to make the destructor of both bases virtual? I'm currently declaring the destructor of B
as protected
to forbid other users from doing this, but is it enough?
What about the destructor of D
?