Adriaan van Os via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am Mi., 1. Mai 2024, 17:07:
> 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 ? > In addition to what Martin said: as long as you have a non-static class method the value of the variable you call the class method on (e.g. myClass in your example) will be passed as Self parameter. So no need for extra parameters. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal