[fpc-pascal] with in classes/records

Sven Barth pascaldragon at googlemail.com
Thu Sep 6 17:08:43 CEST 2018


Ryan Joseph <ryan at thealchemistguild.com> schrieb am Do., 6. Sep. 2018,
16:33:

>
>
> > 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.
>

No, it was always (as far as the idea exists at least) the idea that all
abilities of a property should be available for non-indexed default
properties as well.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180906/65d78e53/attachment.html>


More information about the fpc-pascal mailing list