Try OpenEdge Now
skip to main content
Object-oriented Programming
Designing Objects: Inheritance, Polymorphism, and Delegation : Class hierarchies and inheritance : Calling up the class hierarchy : SUPER system reference
 
SUPER system reference
You can invoke the super class implementation of an instance method using the SUPER system reference. Executing a super class method using the SUPER system reference within a subclass causes control to switch to the version of the method in the next higher super class that implements it, bypassing any classes that do not implement the method. The SUPER system reference is normally used to invoke the super class behavior for a method from within the subclass method that overrides the invoked behavior, and there by construct a chain of behavior. However, it can also be used to invoke any other method in a super class. Therefore, the method name to invoke is part of the syntax.
Note: The SUPER system reference is different from the SUPER statement. You can only invoke the SUPER statement from within a constructor and it invokes a specified super class constructor. For more information, see SUPER statement.
This is the syntax to call a super class version of a method using the SUPER system reference:

Syntax

[return-variable = ]
    SUPER:method-name ( [parameter[ , parameter]...] ) [ NO-ERROR ]
Element descriptions for this syntax diagram follow:
return-variable
If the method returns a value that is assigned, the variable to hold the value returned by the method.
method-name
The name of the method to call in the class hierarchy. The first method found, starting from the immediate super class of the current class and searching upward in the class hierarchy, is the method executed. It might be anywhere in the class hierarchy starting from the immediate super class.
The name of the method can identify any valid method in the class hierarchy. Its name does not need to match the name of the method from which the call is made.
Note that the definition found for method-name in the super class hierarchy cannot be abstract. Otherwise, ABL raises a compiler error. Note that the intent and function of SUPER is to invoke the implementation of the method definition found in the super class hierarchy. If the method is abstract, its definition has no implementation and therefore cannot be executed.
[ parameter [ , parameter]...]
The parameters of the method. For more information on the syntax of parameter, see the Parameter passing syntax reference entry in OpenEdge Development: ABL Reference.
NO-ERROR
Optionally redirects error processing when the method is called as a statement.
From within a class, any invocation of an overridden method without the use of the SUPER system reference invokes the most derived subclass's implementation of the method. From within a class, any invocation of an overridden method with the use of the SUPER system reference invokes the super class's implementation of the method. There is no direct access to the super class's implementation of the overridden method from outside the class.
The SUPER system reference does for class methods what the RUN SUPER statement does for internal procedures running in a persistent super procedure. Both provide access to code further up the execution stack. The RUN SUPER statement, which must appear in an internal procedure, runs the super procedure version of the current internal procedure.