[fpc-pascal] Initialization of class field

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Jul 31 14:56:34 CEST 2012



On Tue, 31 Jul 2012, Krzysztof wrote:

> Hi,
>
> I'm reading about variable initialization
> (http://www.freepascal.org/docs-html/ref/refse22.html) . Can I
> initialize class field too? Like in Java:
>
> type
>  TMyClass = class
>  private
>    FSomeField: Integer = 123;
> end;
>
> I always initialize this in overrided constructor, but above example
> is much faster.

Object Pascal currently does not support this, except maybe for static class
variables. The compiler people should confirm this.

Michael.



More information about the fpc-pascal mailing list