Function IsMethod() Foundation
Checks if an object has a particular method
IsMethod( <oObject>, <cMethodName>, [<nAttributes>] ) --> lExist
Constant | Equivalent in the class declaration |
---|---|
CLASS_HIDDEN | HIDDEN: |
CLASS_PROTECTED | PROTECTED: |
CLASS_EXPORTED *) | EXPORTED: |
|
Constant | Equivalent in the class declaration |
---|---|
METHOD_INSTANCE | METHOD <cMethodName> |
METHOD_CLASS | CLASS METHOD <cMethodName> |
The return value is .T. (true) if the object has the method <cMethodName>, otherwise it returns .F. (false).
The function IsMethod() is used to check if an object has a particular method. This is especially useful for objects of derived classes or dynamically created classes, or when calling methods with the macro operator. Together with IsMemberVar(), :className() and :isDerivedFrom(), IsMethod() offers a complete set of possibilities for analyzing objects at runtime.
// In the example, a user defined function which is capable of
// calling any method of an arbitrary object is programmed.
FUNCTION CallMethod( oObj, cMethodName, xParam )
LOCAL xRet
IF IsMethod( oObj, cMethodName )
xRet := oObj:&cMethodName.( xParam )
ENDIF
RETURN xRet
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.