THistogramArrayBase and inheritance from std::vector
Issue #15
new
Hello
THistogramArrayBase is considered as a polymorphic class (according to examples).
Unfortunately, this class itself has a public inheritance from non-polymorphic std::vector that has no virtual destructor.
This issue is explained, for example, here: https://stackoverflow.com/a/4357417
It is possible to use composition instead of inheritance?
Thanks
Comments (3)
-
-
-
assigned issue to
-
assigned issue to
-
basically, if it does not have a virtual destructor, one should not extend it. this is the best I understand the situation in c++. beats me why c++ does not enforce this. also read:
and
https://www.thecodingforums.com/threads/avoid-inheritance-from-std-map.648721/
K.O.
- Log in to comment
i agree, looks like a mistake. I myself avoid extending standard library classes. K.O.