Re: STL non virtual DTOR
Sushrut Sardeshmukh wrote:
Why did STL designer chose not to make std:list DTOR virtual.
Doubtlessly for the same reasons they didn't make any of the
other functions virtual, and didn't define a contract for the
derived classes to respect. The role of std::list is not that
of a base class, but rather of a concrete implementation of a
particular type of container.
making its DTOR virtual will make our life easier, isn't it?
I don't see how?
Also..
In which case I should do this and which case I should not.
class my_generic_list:: public std::list
{
//my code
}
Normally, I'd say that you shouldn't do it. I think that there
are special cases in meta-programming, where there are never
actually any instances of the derived class, but other than
that, I'd say that such derivation is symptomatic of poor
design.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]