[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;
Michael Van Canneyt
michael at freepascal.org
Sat Jan 14 21:36:31 CET 2023
On Sat, 14 Jan 2023, Wayne Sherman wrote:
> On Sat, Jan 14, 2023 at 10:34 AM Michael Van Canneyt wrote:
>> On Sat, 14 Jan 2023, Wayne Sherman wrote:
>>> 2) Doesn't each object already have the parent properties included in
>>> its own properties by inheritance?
>>
>> Why this question ?
>> An object does not know the property count of the parent.
>
> True, but why does it need to know the property count of the parent?
>
> TBaseClass = class
> private
> FField1: integer;
> protected
> FPropModifiedFlags: TBits;
> published
> property Field1: integer read FField1 write FField1;
> end;
>
> GetTypeData(TBaseClass.ClassInfo)^.PropCount = 1
>
> TDescendant = class(TBaseClass)
> private
> FField2: integer;
> published
> property Field2: integer read FField2 write FField2;
> end;
>
> GetTypeData(TDescendant.ClassInfo)^.PropCount = 2
>
> TDescendant has two properties (one inherited and one declared
> directly) and let's say it can record if any of the properties have
> been modified. So why does it have to know about the number of
> properties it inherited vs the properties it declares directly?
Because there may be other published properties that are not part of the
REST protocol. You may for instance decide to add published properties to a
base class that describe where to save the object in a local database.
Michael.
More information about the fpc-devel
mailing list