[fpc-pascal] Traits Proposal
Ryan Joseph
genericptr at gmail.com
Wed Feb 10 20:17:09 CET 2021
> On Feb 10, 2021, at 11:09 AM, Ryan Joseph <genericptr at gmail.com> wrote:
>
> type
> TSomeTrait = trait
> public
> parent: TObject;
> procedure DoThis;
> end;
>
> procedure TSomeTrait .DoThis;
> begin
> // ??? here is our issue. Is this good enough to call the TBaseClass.DoThis?
> TBaseClass(parent).DoThis;
> end;
Thinking about this more I don't think there's even a reason for it since Object Pascal doesn't let you do stuff like this anyways. If you want to call the super class you need to use "inherited" from within the class body. The example I posted only works if there is no virtual/override involved.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list