$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-05-26 11:27:45
"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:
- allocate enough of memory to hold largest derived object
- construct derived object 1
- destruct derived object 1 but keep its base class data
- construct derived object 2 on the same place and 'reuse' base class data
Its rather dubious trick and probably relies on undefined behaviour
but may work for typical compilers/situations.
/Pavel