Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Using static members of a class : Accessing static members : Calling overridden and super-class static methods
 
Calling overridden and super-class static methods
When an instance method is overridden in a class hierarchy, calling the method will, by default, always polymorphically invoke the overridden method implementation in the most derived subclass, unless you invoke the method using the SUPER system reference. Using SUPER, you can call any overridden method implementation in the immediate super class. All other implementations of the overridden instance method within the same class hierarchy are effectively hidden from access (see Overriding methods within a class hierarchy.
However, when a static method is overridden in a class hierarchy, this does not define a polymorphism, and you can call any implementation of the overridden method in the hierarchy with reference to its implementing class type. Unlike for instance methods, each override of a static method represents a re-definition that is available for execution at any point in your code using static type-name syntax.
If you call an overridden static method (whether from inside or outside the class hierarchy where it is defined), ABL executes the static method implementation at the closest point in the hierarchy of the specified class type. Thus, if the method is implemented in the specified class definition, that method is called; however, if the method is defined in a super class of the specified class definition, the method in the closest super class to the specified class definition is called.
Note that an unqualified reference to a static method can never execute an override in a subclass that derives from the calling class, because there is no class instance that defines and contains the further derived subclass as part of its class hierarchy. The only way to access a further derived override of a static method that is defined in the current class hierarchy is to call the override directly with reference to the overriding class type. In addition, the static method override that you call must be public, like any static method that you call on a class type outside of the current class hierarchy.