[fpc-pascal] Is it only properties that can have defaults in type definitions?

Martin lazarus at mfriebe.de
Thu Mar 14 16:38:38 CET 2013


On 14/03/2013 15:35, Frank Church wrote:
> Is it only properties that can have defaults in type definitions?
> ie can private fields be only initialized after creation, eg in the constructor?
>
> Is something like this allowed
>
> TSomeObject = TObject
> private
>    FBoolean: Boolean default false;
> public
>    FPublishedBoolean: Boolean read FBoolean write FBoolean default false;
> end;
>
>
>

"default" does NOT initialize the property.

It is used for streaming. This value will not be wriiten to an lfm for 
example, and if loaded, then it acts as default



More information about the fpc-pascal mailing list