David
Sat Nov 26 17:01:16 CST 2005
"Mark" <swozz_@hotmail.com> wrote in message
news:OKsiP4r8FHA.4076@tk2msftngp13.phx.gbl...
> So you shouldn't be inheriting from a class with no virtual
> destructor but if this was always the case then why does the
> compiler let you do it?
Depends what you mean by "shouldn't". :-)
Sometimes you want to manipulate an object using a pointer to a base
class and you need a virtual destructor.
Sometimes you just want an object with all the properties of another
one and a few more, so you derive it, and always manipulate the
derived object itself. You can get by happily without a virtual
destructor. But if you're in any doubt that you might want to do
something else - then make the destructor virtual.
Just my (probably heretic) 2d worth.
Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm