Subject: Re: [boost] [Review] GGL review starts today, November 5th
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-11-22 20:02:57
Patrick Horgan wrote:
> Steven Watanabe wrote:
>> FWIW, non-virtual destructors are the norm in Boost.
>> I strongly dislike the idea of having a policy enabling
>> virtual destructors.
> Steven, could you tell me the reason for this?
There aren't a lot of virtual function in Boost either.
In ggl, the only virtual functions I see are in exception classes.
> I have always thought that if you had virtual methods, you should have
> a virtual destructor since the derived class has something different
> about it and if being destructed via a reference or pointer to base,
> the wrong thing could happen without a virtual destructor! Educate me
> please. I've never heard of any reason to avoid a virtual destructor
> if you already had virtual methods. Obviously I'm missing something
> about something I thought I understood.
I don't think so. If you're using virtual functions in the
normal OO way, a virtual destructor almost always
makes sense. (The use of virtual in Boost.Exception
is somewhat different. virtual is being used as an
implementation detail to separate a fragment of the
interface of a concrete type from the rest of the type
in order to minimize dependencies. It isn't being used
for polymorphism at all)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk