somSupportsMethod - Example Code

/* ------------------------------------------------
   Note:  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
*/


[Back: somSupportsMethod - Related Methods]
[Next: somSupportsMethod - Topics]