The wpFree method is generally overridden by storage classes such as WPFileSystem and WPAbstract, which provide for the permanent storage of an object's instance data. In addition, if you have an application that needs to destroy an object, call wpDelete rather than wpFree since it provides the user a chance to confirm the deletion. In this example, wpFree is overridden so that a count of stack object instances can be maintained. It is important that the somSelf pointer for the object not be used again following the call to parent_wpFree. The following sample code shows the use of wpFree:
SOM_Scope BOOL SOMLINK stk_wpFree( Stack *somSelf) // In - pointer to the object // The method returns the value // TRUE = successful // FALSE = error { BOOL bStatus; SOMClass *Class; // StackData *somThis = StackGetData(somSelf); StackMethodDebug("Stack","stk_wpFree"); Class = _somGetClass(somSelf); bStatus = parent_wpFree(somSelf); if (bStatus) { _clsDecObjectCount(Class, STK_PERSISTENTCOUNT); } /* Endif */ return(bStatus); } // End stk_wpFree