[fpc-pascal] Generics vs TCollection

tcoq tcoq at free.fr
Wed Nov 9 17:47:40 CET 2011


It's also possible to create a generic descendent of TCollection, where the only duplicated code is the property override. This is probably the best of both worlds: reusing the TCollection while moving to generics.
Best regards
Thierry
----- Mail Original -----
De: "michael vancanneyt" <michael.vancanneyt at wisa.be>
À: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
Envoyé: Mardi 8 Novembre 2011 13h22:31 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [fpc-pascal] Generics vs TCollection


...
The difference is mainly that in the case of TCollection(Item) you need to
override the items property; With generics, you can skip this step.
At the expense of copying the whole TCollection code each time you create a
specialized descendent.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list