[fpc-devel]Override Default Value of Property

Judison jueca at brturbo.com
Sun Oct 5 23:04:27 CEST 2003


Hi all,

It's posibile to override the default value of a property???

for example:

  TClassA = class
  privare
    FInt: Integer;
  published
    property Int: Integer read FInt write FInt default 0;
  end;

  TClassB = class(TClassA)
  published
    property Int default 5;
  end;

when writing out a TClassA object, the property Int will only be writed if "Int <> 0", the same to a TClassB object, that should (?) write only if "Int <> 5"....

property Int default 5; compiles but has no effect, it's a bug????

PS: I know that I can do it with "stored"... but I think that to override property's default value should work...
PPS: I'm using fpc 1.0.10 with -S2

TIA
Judison




More information about the fpc-devel mailing list