[fpc-devel] restbase.pp LoadFromJSON calling StopRecordPropertyChanges;

Wayne Sherman wsherman at gmail.com
Sat Jan 14 21:06:30 CET 2023


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?


More information about the fpc-devel mailing list