You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Marcus Oladell <mo...@factset.com> on 2001/03/03 22:08:39 UTC

DOM_Node's destructor

I was just wondering if there was reason the destructor of DOM_Node is not
virtual.  It seems to me since
this is the base class of all of the other node classes, it would make
sense to make the destructor virtual.
Is there a design and/or implementation justification for not making this
virtual?

Marcus C. Oladell
Software Engineer
Factset Research Systems


Re: DOM_Node's destructor

Posted by Andy Heninger <an...@jtcsv.com>.
"Marcus Oladell" <mo...@factset.com> asks

> I was just wondering if there was reason the destructor of DOM_Node is
not
> virtual.  It seems to me since
> this is the base class of all of the other node classes, it would make
> sense to make the destructor virtual.
> Is there a design and/or implementation justification for not making
this
> virtual?

DOM_Node, DOM_Element, etc. are just smart pointers to the actual
implementation objects.  The DOM_* classes deliberately have no virtual
functions and consist of exactly one pointer, making them efficient to
pass and return by value.  The *Impl set of classes have virtual functions
in all the of usual places, and provide the expected polymorphism for the
DOM.

Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com