
Le 11/05/2010 19:41, JOAQUIN M. LOPEZ MUÑOZ a écrit :
________________________________________ De: boost-users-bounces@lists.boost.org [boost-users-bounces@lists.boost.org] En nombre de Mathias Gaunard [mathias.gaunard@ens-lyon.org] Enviado el: martes, 11 de mayo de 2010 20:35 Para: boost-users@lists.boost.org Asunto: Re: [Boost-users] metafunction question
Le 11/05/2010 19:30, John Dlugosz wrote:
Consider a class derived from an STL collection.
You should never do that.
Why not, why never? My opinions on this issue at:
http://bannalia.blogspot.com/2008/02/derivation-without-virtual-destructor.h...
While there are technical reasons not to do so (absence of virtual destructor), there are also non technical ones. It simply doesn't make sense to use inheritance for this. Inheritance is for polymorphism, not code reuse. This is why for example free functions that take any range are better than member functions.