<p>Am 31.10.2015 05:31 schrieb "leledumbo" <<a href="mailto:leledumbo_cool@yahoo.co.id">leledumbo_cool@yahoo.co.id</a>>:<br>
><br>
> > TGenClass<> is not a full type, only TGenClass<Integer> is, so you need to<br>
> use - in your example - TSpecType(Obj)<br>
><br>
> Yes, I'm aware of this. The problem is I don't know TSpecType which I said<br>
> the last note. It could be any user defined specialization of TGenClass.<br>
> Back to above code, but closer to my actual complex code:<br>
><br>
[snip]<br>
><br>
> I hope you can get the better picture. One solution is not to use generics<br>
> and return to good old inheritance, but I'm still thinking if there's a<br>
> solution without sacrificing the generics. I don't know how other languages<br>
> which has generics/templates solve this problem, though. Might be worth a<br>
> research.</p>
<p>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).</p>
<p>Regards,<br>
Sven</p>