[fpc-pascal] Traits Proposal

Marco van de Voort fpc at pascalprogramming.org
Mon Feb 15 19:06:37 CET 2021


Op 2021-02-15 om 18:08 schreef Ryan Joseph via fpc-pascal:
>
>> As I understand, this is not a method hiding, but just to tell the
>> compiler which method to implement the interface—the interface could
>> have method names which are very very common to use and this syntax
>> allows us to "rename" those methods without changing the original
>> names that the class might have.
> yeah you may be right, that the interface object itself won't be hookup correctly if this doesn't happen. Seems strange you have 2 declarations for the same method though.
>
>    procedure IMyIntf.Test2 = MyTest2;
>    propcedure MyTest2;
>
>
> instead of something like:
>    
>    propcedure MyTest2 override  IMyIntf.Test2;
The first syntax allows to for methods to be declared in the ancestor too.


More information about the fpc-pascal mailing list