Manager Version
The only difference between a manager and its PermanentEmployee superclass is that managers are given a bonus rate when hired. Therefore, the script for the Hire method that is redefined for the Manager subclass is the simplest of all the classes described.
The following code is the entire Hire method script for Manager:
method Hire() =
declare
errstat = integer not null;
enddeclare
begin
CurObject.BonusTemp = CurObject.BonusRate;
errstat = CurMethod.SendSuperclass();
return errstat;
end
This script first sets a value for the BonusTemp attribute and then invokes its superclass's version of the method. The Manager class's superclass, PermanentEmployee, also invokes the Hire method defined by its superclass, Employee. The SendSuperclass method in this script, therefore, has the effect of superseding the Hire method all the way up the hierarchy.
The SendSuperclass method is effective even if the immediate superclass does not define the method being superseded. For example, assume that the PermanentEmployee class did not define its own version of the Hire method, but its subclass, Manager, needs to supersede the version defined at the top of the hierarchy for the Employee class.
In this case, invoking the SendSuperclass method in the Hire method for Manager automatically invokes the current method as it was defined by Employee. The Manager class's script does not need to specify that it is superseding the method defined for Employee.
For the complete method scripts of the user classes discussed, see the user class components in the online Videos application.