[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


    NAME
	FreeClass -- Frees a boopsi class created by MakeClass(). (V36)

    SYNOPSIS
	success = FreeClass( ClassPtr )
	D0                   A0

	BOOL FreeClass( struct IClass * );

    FUNCTION
	For class implementors only.

	Tries to free a boopsi class created by MakeClass().  This
	won't always succeed: classes with outstanding objects or
	with subclasses cannot be freed.  You cannot allow the code
	which implements the class to be unloaded in this case.

	For public classes, this function will *always* remove
	the class (see RemoveClass() ) making it unavailable, whether
	it succeeds or not.

	If you have a dynamically allocated data for your class (hanging
	off of cl_UserData), try to free the class before you free the
	user data, so you don't get stuck with a half-freed class.

    INPUTS
	ClassPtr - pointer to a class created by MakeClass().

    RESULT
	Returns FALSE if the class could not be freed.  Reasons include,
	but will not be limited to, having non-zero cl_ObjectCount or
	cl_SubclassCount.

	Returns TRUE if the class could be freed.

	Calls RemoveClass() for the class in either case.

    EXAMPLE
	Freeing a private class with dynamically allocated user data:

	freeMyClass( cl )
	struct IClass	*cl;
	{
	    struct MyPerClassData	*mpcd;

	    mpcd = (struct MyPerClassData *) cl->cl_UserData;
	    if ( FreeClass( cl ) )
	    {
		FreeMem( mpcd, sizeof mpcd );
		return ( TRUE );
	    }
	    else
	    {
		return ( FALSE );
	    }
	}

    BUGS

    SEE ALSO
	MakeClass(),
	Document "Basic Object-Oriented Programming System for Intuition"
	and the "boopsi Class Reference" document.