[prog] C++ inheritance - destructors

Sue Stones suzo at bigpond.net.au
Wed May 28 19:17:30 EST 2003


On Wed, 28 May 2003 17:49, Jimen Ching wrote:
> On Tue, 27 May 2003, Kathryn Hogg wrote:
> >If a derived class doesn't explicitly call a constructor for a base class,
> >the default constructor for the parent class.  In fact, the constructors
> >for the parent classes will be called from the ground up.   For example,
> >if you have a base class Vehicle and Car inherits from it, during the
> >construction of a Car, it becomes a Vehicle and then becomes a Car.
>
> I should add that the virtual base class must be initialized by the most
> derived class.  In other words, you can't expect intermediate base classes
> to initialize its own base class.  This is a non-obvious behavior that I
> discovered when I started C++ programming.
>
> --jc

I'm sorry I don't understand what you're talking about, could you explain 
this please.

Thanks

sue


More information about the Programming mailing list