ISO2002MF 

Method Invocation (OO Concepts for Native COBOL)

The procedural code in a method is executed by invoking the method with an INVOKE statement, an inline method invocation or

MF referencing a verb-signature, or

referencing an object property. The method implementation that is bound to the invocation depends on the class, at run time, of the object on which the method is invoked. In particular, it is not necessarily the class specified statically in the definition of the object reference; it is the class of the actual object referenced at run time that is used in resolving a method invocation to a particular method implementation.

If an invocation specifies the object using an object reference, then:

  1. If the identified object is a factory object, the method invocation will resolve to a factory method
  2. Otherwise, the resolution will be to an object method.

If an invocation specifies the object using a class name, the factory object of the specified class is used as the object on which the method is invoked, and the method invocation will resolve to a factory method.

Method resolution proceeds by applying the first one of the following rules that is applicable:

  1. If a method with the method-name specified in the invocation is defined in the class of the object, that method is bound.
  2. If a method with the method-name specified in the invocation is defined in the class that is inherited by the class of the object, that method is bound, including any classes inherited from higher levels of the class hierarchy.
  3. If the method is not found, a run-time system error will result.