Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-07-30 17:36:34


> > [...]
> > Y * pY = new Derived;
> > delete pY;
> >
> > Will result in a segmentation fault.
> > [...]
>
> Even if Y::~Y is virtual?

Yes because virtual tables is like a void * member and you'll have 2
seperate virtual tables in this example.

[...]

> int main()
> {
> X* x = new D;
> delete x;
> }

Try it with:
{
    Y* y = new D;
    delete y;
}

Philippe A. Bouchard


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