<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Adriaan van Os via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Mi., 1. Mai 2024, 17:07:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Suppose I have a<br>
<br>
        var myClass: TClass<br>
<br>
and (for example) a<br>
<br>
        class function TWindow.CreateNewWindow( ....)<br>
<br>
Now I want to call CreateNewWindow for var myClass. Of course, depending on the class, <br>
CreateNewWindow will behave different. Type-casting myClass to TWindow crashes (in my setup). And <br>
even if it worked, wouldn't it loose the class information ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>