[fpc-pascal] Type-casting a class variable

Adriaan van Os adriaan at adriaan.biz
Thu May 2 09:17:43 CEST 2024


Martin Frb via fpc-pascal wrote:

> My example (2nd part of it) was actually wrong.
> 
> It was mentioned before
> 
> On 01/05/2024 19:43, Jean SUZINEAU via fpc-pascal wrote:
>> I didn't tested but I imagine it could be done with something like this ?
>>
>> type
>>        TWindow_Class= class of TWindow;
>> begin
>>           ...
>>           (myClass as TWindow_Class).CreateNewWindow( ....);
> 
> It must be cast to another "class of"

When I do that, the compiler emits

	Class or COM interface type expected, but got "TClass"

I am using

	{$mode macpas}
	{$modeswitch class}
	{$interfaces corba}

Regards,

Adriaan van Os


More information about the fpc-pascal mailing list