Em 27/02/14 19:56, luiz americo pereira camara escreveu:



2014-02-27 18:43 GMT-03:00 Joao Morais <l...@joaomorais.com.br <mailto:l...@joaomorais.com.br>>:

    Correct. The feature I was talking about is something like:

    generic TMyGeneric<T: TMyType>

    And TMyType is a class. In this case the compiler knows I am
    talking about a generic for a class type and a "generic as Java"
    becomes possible.



Seems that you are looking to class type constraints:

http://docwiki.embarcadero.com/RADStudio/XE4/en/Constraints_in_Generics
http://blogs.teamb.com/craigstuntz/2008/08/29/37832

Not sure if will allows to do what you are looking for

Kind of. I usually want some type safety in a generic implementation. A couple of weeks ago I needed a generic type as an abstract class (changed the approach, don't remember details). Most of the time reintroduce some methods casting the inherited one solves the problem.

Thanks for the links! I didn't know the actual Delphi syntax =)


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to