inheritMethod Instruction
The inheritMethod instruction invokes the superclass implementation of a method.
Syntax
The syntax of the inheritMethod instruction is:
inheritMethod [(parameters)];
Description
When a subclass reimplements a method defined in a superclass, you can use the inheritMethod instruction from a subclass method to cause execution of the superclass method.
If the superclass method takes no parameters, the parentheses are optional.
Example
To illustrate the use of the inheritMethod instruction, an openAccount method in the class BankAccount is first written, as follows.
openAccount(acName: String; acAddr: String; acBal: Decimal); begin name := acName; address := acAddr; balance := acBal; status := Account_Status_Open; end;
An openAccount method in the class ChequeAccount is then written, which first calls the openAccount method in the BankAccount superclass and then performs specialized processing relevant only to cheque (or check) accounts.
openAccount(acName: String; acAddr: String; acBal: Decimal); begin inheritMethod(acName, acAddr, acBal); orderChequeBook; end;