10.6 Inheritance

As noted in the previous section, it is possible to create descendants of helper classes. Since only the last helper class in the current scope can be used, it is necessary to descend a helper class from another one if methods of both helpers must be used. More on this in a subsequent section.

A descendent of a class helper can extend a different class than its parent. The following is a valid class helper for TMyObject:

TObjectHelper = class helper for TObject  
  procedure SomeMethod;  
TMyObject = class(TObject)  
TMyObjectHelper = class helper(TObjectHelper) for TMyObject  
  procedure SomeOtherMethod;  

The TMyObjectHelper extends TObjectHelper, but does not extend the TObject class, it only extends the TMyObject class.

Since records know no inheritance, it is obvious that descendants of record helpers can only extend the same record.

Remark: For maximum delphi compatibility, it is impossible to create descendants of record helpers in Delphi mode.