somSubstituteClass - Remarks

The somSubstituteClass method causes the somFindClass, somFindClsInFile, and somClassFromId methods to return the class named newClassName whenever they would normally return the class named origClassName. This effectively results in class newClassName replacing or substituting for class origClassName. For example, the <origClassName>New macro will subsequently create instances of newClassName.

Some restrictions are enforced to ensure that this works well. Both class origClassName and class newClassName must have been already registered before issuing this method, and newClass must be an immediate child of origClass. In addition (although not enforced), no instances should exist of either class at the time this method is invoked.

A convenience macro (SOM_SubstituteClass) is provided for C or C++ users. In one operation, it creates both the old and the new class and then substitutes the new one in place of the old. The use of both the somSubstituteClass method and the SOM_SubstituteClass macro is illustrated in the example below.


[Back: somSubstituteClass - Parameters]
[Next: somSubstituteClass - Original Class]