Suppose I have a

        var myClass: TClass

and (for example) a

        class function TWindow.CreateNewWindow( ....)

Now I want to call CreateNewWindow for var myClass. Of course, depending on the class, CreateNewWindow will behave different. Type-casting myClass to TWindow crashes (in my setup). And even if it worked, wouldn't it loose the class information ?

Of course, by adding an extra parameter of type TClass to CreateNewWindow, the issue can be solved. But that's far from elegant.

How to solve this ? Anything I missed ?

Regards,

Adriaan van Os

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to