Hello George,
I want to inherit my class from osgAnimation::StackedRotateAxisElement but I
realized that there is no virtual destructor in the class. Why? Because it is
not needed because the class does not allocate anything from the heap? Or
because it is a bad practice to inherit from this class?
StackedRotateAxisElement itself has no virtual destructor (in fact, no
destructor at all) probably because there was no need for one (no
resources to free).
But in C++, if a class's base class (or its base class, right up to the
root of that class's hierarchy) has a virtual destructor, it's assumed
that all destructors of subclasses (even the default compiler-generated
one that does nothing) are virtual. And since osg::Object has a virtual
destructor (and StackedRotateAxisElement inherits indirectly from
osg::Object) then it can be assumed that you can safely derive from
StackedRotateAxisElement, and your subclass can have a virtual
destructor, and it will be called when appropriate.
Hope this helps,
J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org