Declaring a Derived Class

[This is preliminary documentation and subject to change.]

Classes that derive from other classes are declared with a colon followed by the name of the superclass as the following sample declaration indicates:

class MyClass 
{
    string   strProp;
    sint32   dwProp1;
    uint32       dwProp2;
}

class MyDerivedClass : MyClass
{
    string   strDerivedProp;
    sint32   dwDerivedProp;
};
 

By default, a derived class inherits the properties of its base class. A derived class can declare additional properties and can redeclare one or more of the inherited properties. A redeclared property is added to the list of original properties and any extra qualifiers are added to the list of original qualifiers, subject to the specified propagation rules. When a derived class redeclares a property, its type must remain the same unless it is a reference property. The property's value, if specified, overrides the value defined by the superclass.

A derived class inherits the qualifiers of its base class if those qualifiers have been assigned the value ToDerivedClass.

When the MOF compiler attempts to add a derived class to the CIM repository, its superclass must already exist. The declaration of the superclass can appear in the same MOF file as the derived class or in a different file. A run-time error is generated by the compiler if the superclass is unknown.

A derived class can only have a single superclass; WBEM does not support multiple inheritance. However, a superclass can have many derived classes.