[fpc-devel] Class helper: small differences between FPC and Delphi

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Mar 26 15:37:38 CET 2011


On 26 Mar 2011, at 14:55, Marco van de Voort wrote:

> In our previous episode, Sven Barth said:
>> 1. Record helpers in Delphi don't support inheritance. In FPC they do 
>> and I believe (see point 2) that record helpers in Delphi could support 
>> that as well, but it's been disabled on purpose. I personally think that 
>> inheritance for record helpers increases their use, because you can work 
>> around the "one helper per type" problem by using inheritance.
> 
> I though helpers were mostly static? How does the helped class know what
> exact instance is meant?

It's not for the helped class, and the result is still static since afaik virtual methods are not allowed for class helpers. Because only one class helper can be used for particular class at a time, if you want to enable both the routines of an existing helper and some extra routines in the current scope, you have to create a child of the existing helper and add those extra routines to this child. If you don't inherit from the existing helper then only the new routines will be available.


Jonas


More information about the fpc-devel mailing list