[fpc-devel] Should this compile (property)

Michael Van Canneyt michael at freepascal.org
Thu Nov 12 20:10:57 CET 2026



On Thu, 12 Nov 2026, Martin Frb via fpc-devel wrote:

> Is the constructor a valid Getter?

No. Delphi refuses this, and rightly so.

Michael.

> And if so, create can be called on the instance and on the class, but as 
> getter it only works on the instance. For "class property" it fails.
>
> program Project1;{$Mode objfpc}
> type
>
> TFoo = class
>   constructor Create;
>   property CallCreate: TFoo read Create;
> end;
>
> constructor TFoo.Create;
> begin
> end;
>
> begin
> end.
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>


More information about the fpc-devel mailing list