Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

SELF and SUPER

SELF and SUPER are predefined object references that reference the object on which the current method is executing.

Format


SELF




[class-name-1 OF] SUPER


Syntax rules

  1. SELF and SUPER may only be used in a method definition.

  2. SELF and SUPER may not be specified as a receiving operand.

  3. SUPER may be specified only as the object for which a method is called with the INVOKE statement.

  4. class-name-1 is the name of a class specified in the INHERITS clause of the containing class definition.

  5. If the INHERITS clause of the containing class definition specifies more than one class-name, then class-name-1 must be specified.

  6. If the INHERITS clause of the containing class definition specifies only one class-name, then class-name-1 need not be specified.

  7. SELF and SUPER are both of the class object and are not universal object references.

General rules

  1. SELF and SUPER both reference the object that was used to invoke the method in which the reference to SELF or SUPER appears.

  2. If SELF is specified for a method invocation, the method resolution is based upon the set of methods defined for the runtime class of the object dynamically referenced by SELF.

  3. If SUPER is specified for a method invocation, the method resolution ignores all the methods defined in the class containing the invocation and all the methods defined in any subclass of that class. Thus the invoked method can only be one that is inherited from a superclass.

  4. If class-name-1 is specified, the search for the method will occur only in the methods defined for it.