<div dir="ltr"><div><div><div>Hi All,<br><br>say, I have a class TTree<T>; in the destructor of that class, is it possible to know the actual type of T? I want to do things like:<br><span style="font-family:courier new,monospace"><br>
</span></div><span style="font-family:courier new,monospace">generic TTree<T> = class<br></span></div><div><span style="font-family:courier new,monospace">public<br></span></div><div><span style="font-family:courier new,monospace"> Data: T;<br>
</span></div><div><span style="font-family:courier new,monospace"> destructor Destroy; override;<br></span></div><span style="font-family:courier new,monospace">end;<br><br></span></div><div><span style="font-family:courier new,monospace">destructor TTree.Destroy;<br>
</span></div><div><span style="font-family:courier new,monospace">begin<br> ... ...<br></span></div><div><span style="font-family:courier new,monospace"> if Data is TObject then Data.Free;<br></span></div><div><span style="font-family:courier new,monospace">end;<br>
</span></div><div><br></div><div>But "is" does not work with generic types.<br><br></div><div>Regards,<br></div><div>Xiangrong<br></div></div>