Bull DPX/20 Guia do Utilizador Página 166

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 424
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 165
1-154 SOMobjects Base Toolkit: Programmers Reference Manual
somRespondsTo Method
Purpose
Tests whether the receiving object supports a given method. Not generally overridden.
IDL Syntax
boolean somRespondsTo (in somId methodId);
Note: For backward compatibility, this method does not take an Environment parameter.
Description
The somRespondsTo method tests whether a specific (static or dynamic) method can be
invoked on the receiver object. This test is equivalent to determining whether the class of
the receiver supports the specified method on its instances.
Parameters
receiver A pointer to the object to be tested.
methodId A somId that represents the name of the desired method.
Return Value
The somRespondsTo method returns TRUE if the specified method can be invoked on the
receiving object, and FALSE otherwise.
C Example
/* -----------------------------------------------
: 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
*/
Original Class
SOMObject
Related Information
Methods: somSupportsMethod
Vista de página 165
1 2 ... 161 162 163 164 165 166 167 168 169 170 171 ... 423 424

Comentários a estes Manuais

Sem comentários