2.9. Creating an Abstract Node Class

Creating an abstract node class is slightly different from creating a nonabstract one. Examples of abstract node classes are SoCamera( C++ | Java | .NET ), SoLight( C++ | Java | .NET ), and SoShape( C++ | Java | .NET ).

First, abstract classes should use the ABSTRACT versions of the macros described in SoSubNode.h. For example, the SoLight( C++ | Java | .NET ) class makes this call in its initClass() method:


C++
SO_NODE_INIT_ABSTRACT_CLASS(SoLight, "Light", SoNode);

Second, the constructor for an abstract class should be protected, meaning that it is impossible to create an instance of it.