somRespondsTo - Example Code
/* -----------------------------------------
Note: Animal supports a setSound method;
Animal does not support a doTrick method.
----------------------------------------- */
#include <animal.h>
main()
{
Animal myAnimal;
char *methodName1 = "setSound";
char *methodName2 = "doTrick";
myAnimal = AnimalNew();
if (_somRespondsTo(myAnimal, SOM_IdFromString(methodName1)))
somPrintf("myAnimal responds to %s\n", methodName1);
if (_somRespondsTo(myAnimal, SOM_IdFromString(methodName2)))
somPrintf("myAnimal responds to %s\n", methodName2);
_somFree(myAnimal);
}
/*
Output from this program:
myAnimal responds to setSound
*/
[Back: somRespondsTo - Related Methods]
[Next: somRespondsTo - Topics]