Sven, I really thoght that I had replied your message, but now, I realize I didn't do it.
Actually, the fact compiler does not support the sintax I proposed, it's not very severe. In stead of passing a subtype, I can firstly create a type from the subtype and using it in the specialization: TPersons = TdgOPFentity.Tentities; Passing TPersons, the compiler will not complain. But, say me: is the problem I faced related to 2.4 version? In newer version, would it be possible to use something like I have proposed or will the same behviour be maintained? 2015-05-17 15:46 GMT-03:00, luciano de souza <luchya...@gmail.com>: > Hello listers, > > Using Freepascal 2.6.4, I have a problem about generics. In short, I > can't specialize a class with a subtype of a type declared with > "public type". Let me try to explain. > > In dopf.pas, I have: > > type > generic TdGOpf<T1, T2, T3> = class(TdComponent) > public type > TEntities = specialize TFPGObjectList<T3> > end;; > > If personmapper is a class specialized from TdGOpf, an instance can be > created as follows: > > Personmapper := TPersonMapper.TEntities.create; > > Yes, this code is successul. But this code is not: > > type > generic TGAction <t1, t2> = class(specialize TBrookGAction <t1>); > private > Fentities: t2.TEntities; //Error in type definition > end; > > This code failed, so I tried: > > type > generic TGAction <t1, t2> = class(specialize TBrookGAction <t1>); > public type TCEntities = t2.Tentities; //Error in type definition > end; > > I got also an error if I try: > > type > generic TGAction <t1, t2, t2.TEntities> = class(specialize TBrookGAction > <t1>); > > Well, I think the problem is illustrated. The doubt is how can create > an instance of a public type, in my case, t2.Tentities inside my > specialized class? > > Best regards, > > > -- > Luciano de Souza > -- Luciano de Souza _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal