<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace">Hi Sven,<br></div><div class="gmail_extra"><br><div class="gmail_quote">2013/9/26 Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5"><br></div></div>
As you can see you are constructing a TTreeInteger class inside TTreeInteger.Clone and nothing in the world afterwards can turn it into a TTreeInt.<br></blockquote></div><br><div class="gmail_default" style="font-family:courier new,monospace">
Do you mean that casting TTreeInteger into TTreeInt is not possible because this is to cast a parent class into a child class? If so, how this is possible (mentioned in my earlier question about avoid typecasting):<br>
<br>
</div><div class="gmail_default" style="font-family:courier new,monospace">type<br></div><div class="gmail_default" style="font-family:courier new,monospace"> TIntTree = class(specialize TTree<Integer>)<br></div><div class="gmail_default" style="font-family:courier new,monospace">
end;<br><br></div><div class="gmail_default" style="font-family:courier new,monospace">var<br></div><div class="gmail_default" style="font-family:courier new,monospace"> it1, it2: TIntTree;<br></div><div class="gmail_default" style="font-family:courier new,monospace">
begin<br> ... ...<br></div><div class="gmail_default" style="font-family:courier new,monospace"> it2 := TIntTree(it1.FirstChild);<br></div><div class="gmail_default" style="font-family:courier new,monospace">end.<br><br>
</div><div class="gmail_default" style="font-family:courier new,monospace">This is also casting TTree$Integer (parent class) to TIntTree (child class)?<br><br></div><div class="gmail_default" style="font-family:courier new,monospace">
Regards,<br></div><div class="gmail_default" style="font-family:courier new,monospace">Xiangrong<br></div></div></div>