Am 31.10.2015 05:31 schrieb "leledumbo" <leledumbo_c...@yahoo.co.id>: > > > TGenClass<> is not a full type, only TGenClass<Integer> is, so you need to > use - in your example - TSpecType(Obj) > > Yes, I'm aware of this. The problem is I don't know TSpecType which I said > the last note. It could be any user defined specialization of TGenClass. > Back to above code, but closer to my actual complex code: > [snip] > > I hope you can get the better picture. One solution is not to use generics > and return to good old inheritance, but I'm still thinking if there's a > solution without sacrificing the generics. I don't know how other languages > which has generics/templates solve this problem, though. Might be worth a > research.
You'll have the problem to know the specific class at compile time no matter whether you use generics or inheritance. If you want access to specific methods of the published then I suggest you to either have that class implement an interface or to have it inherit from a common base class that you can check for using "is" (yes, a generic can inherit from a normal class without problems). Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal