Re: [sigc] sigc::trackable::~trackable() is not virtual



On Thu, 2006-10-26 at 08:58 -0400, Paul Davis wrote:
> why is this destructor not virtual by default? i thought it was widely
> accepted good practice that if the class is ever intended to be
> inheritable, its destructor should be virtual?  

Not necessarily. The destructor should be virual if it is intended to be
used polymorphically.

But yes, this would be useful to me sometimes too. I believe the choice
was made once for performance.

And you might actually be better off with your virtual inheritance
elsewhere. Obviously it works for gtkmm, which multiply-inherits
sigc::trackable. Virtual inheritance is a very odd thing and doesn't act
exactly as you might expect.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]