1-104 SOMobjects Base Toolkit: Programmer’s Reference Manual
somSupportsMethod Method
Purpose
Returns a boolean indicating whether instances of a class support a given (static or
dynamic) method.
IDL Syntax
boolean somSupportsMethod (in somId methodId);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somSupportsMethod method determines if instances of the specified class support
the specified (static or dynamic) method.
Parameters
receiver A pointer to the class object to be tested.
methodId An ID that represents the name of the method.
Return Value
The somSupportsMethod method returns 1 (true) if instances of the specified class
support the specified method, and 0 (false) otherwise.
Example
/* -----------------------------------------------
: animal supports a setSound method;
animal does not support a doTrick method.
----------------------------------------------- */
#include <animal.h>
main()
{
SOMClass animalClass;
char *methodName1 = ”setSound”;
char *methodName2 = ”doTrick”;
animalClass =
AnimalNewClass(Animal_MajorVersion, Animal_MinorVersion);
if (_somSupportsMethod(animalClass,
somIdFromString(methodName1)))
somPrintf(”Animals respond to %s\n”, methodName1);
if (_somSupportsMethod(animalClass,
somIdFromString(methodName2)))
somPrintf(”Animals respond to %s\n”, methodName2);
}
/*
Output from this program:
Animals respond to setSound
*/
Original Class
SOMClass
Related Information
Methods: somRespondsTo
Commenti su questo manuale