[ROOT] virtual destructors

From: Axel Naumann (a.naumann@worldnet.att.net)
Date: Thu Apr 19 2001 - 19:29:08 MEST


Hi,

Is there a plan to declare (pretty much all) the destructors as virtual?
Assume you have a base class TB and a class TA: public TB, both defining
their own std destructors.

TB* p = new TA();
delete p;

Here the ~TB will be called, NOT the ~TA, as ~TB is not declared virtual.
(At least that's true for the MS compiler, but as it makes sense I'd think
it works for all compilers.) Or is there a reason I can't see for not
declaring them virtual? At least changing this would be "mostly" backwards
compatible...

Regards, Axel.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET