[This is preliminary documentation and subject to change.]
Use the DWbemClassObject.SpawnDerivedClass method to create a new derived class object from the current object. The object must be a class definition that becomes the superclass of the spawned object.
DWbemClassObject.SpawnDerivedClass(
[in] lFlags As Long,
[out] ppNewClass As Object
) As Long
WBEM_E_FAILED | Unspecified error. |
WBEM_E_ILLEGAL_OPERATION | The user requested an illegal operation, such as spawning a class from an instance. |
WBEM_E_INCOMPLETE_CLASS | The source class was not completely defined or registered with CIMOM, so a new derived class is not permitted. |
WBEM_E_INVALID_PARAMETER | ppNewClass is NOTHING. |
WBEM_E_OUT_OF_MEMORY | There was not enough memory to complete the operation. |
WBEM_NO_ERROR | Success. |
The new object returned in ppNewClass automatically becomes a subclass of the current object. This behavior cannot be overridden. There is no other method by which you can create derived classes.
You cannot create a derived class from a class that is local to your own client process. You must create the base class, register it with CIMOM, and retrieve it using DIWbemServices.GetObject before you can use this method to create a derived class. To create a class hierarchy, you must create the initial class with DIWbemServices.PutClass, retrieve it using DIWbemServices.GetObject, and use the retrieved object to create the newly derived class. After that, you must use DIWbemServices.PutClass to create the newly derived class. To create other derived classes, you must call DIWbemServices.GetObject, then call DWbemClassObject.SpawnDerivedClass, and so on, in a cycle for each new derivation level. In order to prevent version errors and concurrency conflicts, you need to follow this procedure. To create a class with no parent, see Class Creation.