How is this "interface"-like structure/pattern called?

Posted by Sebastian Negraszus on Programmers See other posts from Programmers or by Sebastian Negraszus
Published on 2011-11-15T16:45:35Z Indexed on 2011/11/15 18:07 UTC
Read the original article Hit count: 203

Filed under:
|
|

Let's assume we have an XmlDoc class that contains basic functionality for dealing with an XML data structure and saving/loading data to/from a file. Now we have several subclasses, A, B and C. They all inherit from XmlDoc and add component-specific methods for setting and getting lots of data. They are like "interfaces" but also add an implementation for the signatures.

Finally, we have an ABCDoc class that joins all the "interfaces" via virtual multiple inheritence and adds some ABCDoc-specific stuff, such as using XMLDoc-methods to set an appropriate doc type. We may also have an ADoc class for only saving A data.

How is this pattern called? "Interface" is not really the right word since interfaces usually do not contain an implementation.

Bonus points for C++ code conventions.

© Programmers or respective owner

Related posts about c++

Related posts about terminology