Am 18.02.2021 um 20:33 schrieb Martin Frb via fpc-pascal:
could be written as

  generic TTrait<T> = class(T)
    procedure Bar;
  end;

  TMyFoo = class(specialize TTrait<TFooBase>)
     procedure Foo;
  end;

Of course that can get out of hand, if you want to include many traits.

You need to constrain T as a TObject, then it works.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to