On 02 Aug 2009, at 04:17, Martin wrote:

I am wondering if the code below is valid or not.

It is not.

It executes, but compiled with -CR gives a runtime error in fpc_check_object

xfoo is a variable to store a class of TFooClass, or any inherited class. It is initialized with the inherited class TBar.

No, it is initialised with tfoo in your test program:

begin
xfoo := tfoo;


However casting tothe class of TBar (using TBarClass) causes an error?

If you initialise xfoo with tbar, the casting works fine.


Jonas
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to