[fpc-pascal] with in classes/records

Ryan Joseph ryan at thealchemistguild.com
Thu Sep 6 16:32:47 CEST 2018

> On Sep 6, 2018, at 9:25 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
> No, the whole point of default is that they should be for any kind of field.
> For example if you want a nullable boolean, you'll do something like
> Type
>    TNullable<T>= Record
>    Private
>      F : T;
>      isAssigned : Boolean;
>      Function GetValue : T;
>      Procedure SetValue(aValue : T);
>      Property Value : T Read GetValue Write SetValue; default;
>      Property IsNull : Boolean Read GetISNull Write SetIsNull;
>    end;

Thanks for the example. I didn’t even know it was intended for the default property to have functions as the read/write values. I thought read/write was always going to map directly to a field.

	Ryan Joseph

More information about the fpc-pascal mailing list