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,
