SOM Kernel Reference 1-119
C Example
/*
* The following example is a hypothetical
* implementation of an override of the somNew method
* in a subclass of SOMClassMgr. It illustrates the
* proper use of the somMergeInto method.
*/
SOM_Scope SOMAny * SOMLINK somNew (MySOMClassMgr somSelf)
{
SOMAny *newInstance;
static int firstTime = 1;
/*
* Permit only one instance of MySOMClassMgr to be created.
*/
if (!firstTime)
return (SOMClassMgrObject);
newInstance = parent_SOMClassMgr_somNew (somSelf);
/*
* The next line will transfer the class registry
* information from SOMClassMgrObject into our
* new instance.
*/
_somMergeInto (SOMClassMgrObject, newInstance);
/* As a result of the above operation
* SOMClassMgrObject is now set to point to the
* new instance of MySOMClassMgr.
*/
firstTime = 0;
return (newInstance);
}
Original Class
SOMClassMgr
Kommentare zu diesen Handbüchern