Proto Inheritance

The inherited Keyword

You might find, at times, that you don't want to completely override an inherited method. Perhaps you wish to keep the original and amend that behavior. So how do you write an overridden method that adds to the original, rather than completely replacing it? You use the inherited keyword:

frame.Method := func(a)
begin
   // do some stuff

   // and then call old version
   inherited:Method(a);
end;
When you use inherited to call an old version of a method, self retains its current value. As far as the old method is concerned, it is as if the overridden method were not there (self remains the same).

The :? Operator

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996