Try OpenEdge Now
skip to main content
Object-oriented Programming
Designing Objects: Inheritance, Polymorphism, and Delegation : Class hierarchies and inheritance : Constructing an object : SUPER statement
SUPER statement
In order to enforce the construction of an object hierarchy from the top of the object hierarchy to the bottom, the very first action of the instantiating subclass constructor (as invoked by the NEW function) must either be an implicit call to the default constructor of the immediate super class or an explicit call to a constructor of the immediate super class using the SUPER statement. If all super class constructors have parameters (that is, there is no default super class constructor), the first executable statement in the instantiating subclass constructor must be either an explicit call to a super class constructor using the SUPER statement or an explicit call to an overloaded constructor using the THIS-OBJECT statement whose first statement explicitly or implicitly invokes a super class constructor. If the super class has no constructors defined or defines a constructor with no parameters (that is, it has a default constructor), an explicit call to a super class constructor is optional. Also, with a default super class constructor, if a subclass does not need to execute any statements of its own to initialize work when the subclass is instantiated, the subclass does not need to define a constructor. The NEW function automatically invokes the default constructor for the instantiated subclass when the NEW function is specified with no parameters, and the AVM automatically calls the default super class constructor as the initial action of the instantiating subclass constructor.
This is the syntax to invoke the immediate super class constructor using the SUPER statement:


SUPER ( [parameter[ , parameter]...] ) .
Element description for this syntax diagram follow:
[ parameter [ , parameter]...]
The parameters, if any, passed to the specified super class constructor. For more information on the syntax of parameter, see the Parameter passing syntax reference entry in OpenEdge Development: ABL Reference.
Note: It is a compiler error to specify NO-ERROR on the SUPER statement. Any ERROR condition raised during execution of a constructor can be handled only by the statement that instantiates a class with the NEW function. For more information, see Raising and handling error conditions.
The syntax for the SUPER statement appears similar to the syntax for the SUPER built-in function, used to invoke user-defined functions in a super procedure. However, unlike the SUPER built-in function, which you must invoke inside an expression in a procedure, you can only invoke the SUPER statement as the first statement in a subclass constructor.