Call methods from inside a class hierarchy where they are defined
- Last Updated: February 9, 2026
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Syntax
You can directly access methods from within the class hierarchy
where they are defined by invoking the method name. This includes all methods
implemented directly within the class definition and all PUBLIC, PACKAGE-PROTECTED, PACKAGE-PRIVATE, and PROTECTED methods implemented in any super class of the class
hierarchy. Invoking an overridden method from within a class hierarchy executes the
method defined in the most derived subclass of a given class hierarchy. This is true
even if the method is called from a super class that contains an overridden
implementation. Thus, for an instance method, the actual implementation of a method
invoked from within its own class definition depends on where that class definition
resides in the class hierarchy of a given class instance.
You can also use additional ABL elements to access instance methods within the hierarchy that have the following characteristics:
- The method is defined, and possibly overridden, in one or more
super classes. By default (as noted above), invoking the method always invokes
the most-derived method in the class hierarchy. However, you can, instead,
invoke the closest implementation in a super class of the current class
definition by using the
SUPERsystem reference. - The method has the same name as a reserved keyword. By default,
ABL does not allow you to invoke a method with such a name directly within the
class hierarchy where it is defined, but you can invoke the method using the
THIS-OBJECTsystem reference. You can also useTHIS-OBJECTto improve code readability for an internal hierarchy method call.
This is the syntax to invoke a method from inside a class:
|
Element descriptions for this syntax diagram follow:
- [ SUPER ]
- A system reference that allows you to call the closest overridden implementation of an instance method specified by method-name and an equivalent signature in the current class hierarchy. For more information, see SUPER system reference.
- [ THIS-OBJECT ]
- A system reference that allows you to call an instance method defined in the current class hierarchy when method-name is a reserved keyword. This system reference can also provide an aid to coding. For more information, see THIS-OBJECT system reference.
- data-element
- If the method returns a value that is assigned, the name of a variable, property, or other data element defined to hold any return value.
- method-name
- The name of an accessible method in the class hierarchy.
- [ parameter [ , parameter]...]
- The parameters, if any, of the method. For more information on the syntax of parameter, see Parameter passing syntax.
- [ NO-ERROR ]
- Optionally redirects error processing when the method is called as a statement.
The following is an example from the sample class, acme.myObjs.CustObj, where MessageHandler( ) is an abstract method defined in and inherited from
the abstract class, acme.myObjs.Common.CommonObj,
and implemented in CustObj:
|
The constructor in CustObj invokes
the PROTECTED method MessageHandler( ) within its class hierarchy by directly calling the
method by its name:
|