2012/12/4 Marcos Douglas <span dir="ltr"><<a href="mailto:md@delfire.net" target="_blank">md@delfire.net</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On Tue, Dec 4, 2012 at 4:53 PM, Sven Barth <<a href="mailto:pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>> wrote:<br>
> On 04.12.2012 20:03, Marcos Douglas wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> See the code below.<br>
>> My question is: Why the cast worked, considering the c variable is a<br>
>> TAClass instance, not a TBClass.<br>
><br>
><br>
> As long as you don't access fields of TBClass inside of GetInfoA you won't<br>
> run into problems, because FInfoA is accessed using an offset. If you want<br>
> to catch such problems you should compile with "-CR". The output will then<br>
> look like the following:<br>
><br>
> === output begin ===<br>
><br>
> An unhandled exception occurred at $080482E8 :<br>
> EInvalidCast : Invalid type cast<br>
> $080482E8<br>
><br>
> === output end ===<br>
><br>
> As a sidenote: as long as you don't access an object member at all you'd<br>
> even be able to cast a primitive type like Integer to an object and call<br>
> methods on it... (not that I'd suggest to do this... ;) )<br>
><br>
> Regards,<br>
> Sven<br>
<br>
</div>Excellent explanation, thank you.<br>
<span class=""><font color="#888888"><br>
Marcos Douglas</font></span></blockquote></div><br clear="all"><div>This is witchcraft! :)<br></div><div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a><br>
</div>