[fpc-pascal] Type-casting a class variable
Marco van de Voort
fpc at pascalprogramming.org
Thu May 2 19:07:33 CEST 2024
Op 2-5-2024 om 08:32 schreef Adriaan van Os via fpc-pascal:
>
>> TWindow(myClass).CreateNewWindow;
>
> And this is what crashes. I can report this, if the type-cast is
> supposed to work.
>
Known gotcha. Is and as are no good for method variables, use:
if myclass.inheritsfrom(twindow) then
twindow(myclass).createnewwindow
else
raise exception.create('something''s rotten in the state of ...');
More information about the fpc-pascal
mailing list