GetMethod

Retrieves the implementation function of a method.

Method := GetMethod(Value, Name)

Parameters

Value

Type: Any

Any value, of any type except ComObject.

Name

Type: String

The name of the method to retrieve.

Return Value

Type: Function Object

This function returns the function object which contains the implementation of the method.

Errors

If the method is not found, an exception is thrown.

Remarks

The method may be pre-defined (built-in), defined within a class definition or by calling DefineMethod. Inherited methods are included in the search. Methods implemented through the __Call meta-function cannot be detected and may not even have a corresponding function object.

When calling the function object, it is necessary to supply a value for the normally-hidden this parameter. For example, %Method%(Value).

Related

Objects, HasMethod, HasBase, HasProp

Examples

#1

method := GetMethod({}, "GetMethod")  ; It's also a method.
MsgBox method.MaxParams  ; Takes 2 parameters, including 'this'.
MsgBox method = Func("GetMethod")  ; Actually the same object in this case.