$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-05-03 10:08:06
Ralf W. Grosse-Kunstleve:
> My primary question still is:
> What is the disadvantage of adding the virtual destructors?
> The Stroustrup book has a very clear recommendation (below).
> Why not follow this advice? I'm keen to learn the facts.
A destructor that is never supposed to be called (except by the destructor 
of the derived class) doesn't need to be virtual. There's not much point in 
trying to avoid the undefined behavior in "delete sp.get()". sp is now a 
time bomb.
A protected destructor, on the other hand, yields a compile-time error. You 
can still make it virtual if you like. It's a bit contradictory for the 
reader as you appear unable to make up your mind as to whether the 
destructor is supposed to be part of the base class interface or not, but 
most of them are familiar with g++ by now, so they won't be confused for 
long.