Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-05-26 14:12:09


"Andreas Huber" <ah2003_at_[hidden]> wrote:

> >> Making a transition between two inner states is the equivalent of
> >> destructing the derived class portion of the object but leaving the
> >> base class portion intact and then constructing a different derived
> >> class object on top of
> > the base class portion. This is of course not possible in C++ ....
>
> > It is sort of possible using placement constructors and destructors:
....
>
> Hmm, how do you avoid that the base class constructor is called when you
> construct the derived object 2? Not that I have ever used placement new,
but
> I can't recall having seen the possibility of not calling the base class
> constructor when you call a derived class constructor.
>
The base class constructor needs to be aware of the trick.
There should be flag indicating whether or not the data
are already 'initialized' and constructor would act on this info.

/Pavel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk