[fpc-devel] "class of TFoo".Create

Bart bartjunk64 at gmail.com
Sun Jul 6 14:38:47 CEST 2025


On Sun, Jul 6, 2025 at 1:57 PM Martin Frb via fpc-devel
<fpc-devel at lists.freepascal.org> wrote:


> program Project1;
> {$mode objfpc}
> type TFoo = class end;
>       TFooClass = class of TFoo;
> var f: TFoo;
>      fc: TFooClass;
> begin
>    fc := TFoo;
>    f  := fc.Create;
>    f  := TFooClass.Create;  // works
> end.

Delphi (7) happily compiles that as well.
And f is of type TFoo there as well.

-- 
Bart


More information about the fpc-devel mailing list