SOM Kernel Reference 1-143
somGetClass Method
Purpose
Returns a pointer to an object’s class object. Not generally overridden.
IDL Syntax
SOMClass somGetClass ( );
Note: For backward compatibility, this method does not take an Environment parameter.
Description
somGetClass obtains a pointer to the receiver’s class object. The somGetClass method is
typically not overridden.
Important : For C and C++ programmers, SOM provides a SOM_GetClass macro that
performs the same function. This macro should only be used only when absolutely
necessary (that is, when a method call on the object is not possible), since it bypasses
whatever semantics may be intended for the somGetClass method by the implementor of
the receiver’s class. Even class implementors do not know whether a special semantics for
this method is inherited from ancestor classes. If you are unsure of whether the method or
the macro is appropriate, you should use the method call.
Parameters
receiver A pointer to the object whose class is desired.
Return Value
A pointer to the object’s class object.
C Example
#include <animal.h>
main()
{
Animal myAnimal;
int numMethods;
SOMClass animalClass;
myAnimal = AnimalNew ();
animalClass = _somGetClass (myAnimal);
SOM_Test(animalClass == _Animal);
}
Original Class
SOMObject
Related Information
Macros: SOM_GetClass
Komentáře k této Příručce