[fpc-pascal] How to use generics and meta class?

silvioprog silvioprog at gmail.com
Wed Feb 26 04:44:17 CET 2014


2014-02-25 5:45 GMT-03:00 Sven Barth <pascaldragon at googlemail.com>:
[...]

>  So, which syntax to use generic and meta class?
>>
>
> What might work (untested) is this:
>
> === code begin ===
>
> type
>
>   generic TMyGeneric<T> = class
>   public type
>     TMyGenericClass = class of TMyGeneric; // in mode Delphi this would be
> "class of TMyGeneric<T>"
>   public
>     class procedure RegisterItem(aItemClass: TMyGenericClass);
>   end;
>
> === code end ===
>
> Regards,
> Sven
>

Yyyeeesss buddy, it compiles! I'll continue my implementations this
weekend. Generics is really wonderful! :)

I will continue my implementations this weekend.

Thanks a lot!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140226/bcd9caa0/attachment.html>


More information about the fpc-pascal mailing list