[xsd-users] abstract type and its c++ equivalent

Boris Kolpackov boris at codesynthesis.com
Tue Apr 23 10:34:46 EDT 2013


Hi Georg,

Klima Georg <G.Klima at durst-online.at> writes:

> I'm having troubles understanding why an abstract schema type isn't
> mapped to an abstract / pure virtual / not instantiable class type
> in c++?

It is not a good idea to add a pure virtual function (e.g., d-tor) to
class that is otherwise non-polymorphic. That would result in code
bloat. However, I don't see any harm in making all its c-tors
protected so that they are inaccessible from user code. I've added
this item to the TODO list for the next release.


> My motivation for this problem is that I'm implementing a visitor
> pattern and so can't implement pure virtual functions within
> classes of schema abstract types.

I don't see why this is a problem. Just leave the "visiting" functions
for abstract types as pure virtual?

Boris



More information about the xsd-users mailing list