> > Here the Data getter is called, ie, hSafeVar, because you are reading a > value from it. > > Use a function as a getter instead of a class member. Btw getters and > setters have not the same syntax, you need to create two different methods.
Was it this you meant? Now I cannot compile. If I change rSafeVar (In the property declaration) to hSafeVar it compiles. Carsten ------------------------------------------------- program safevartest; {$mode objfpc} Uses sysutils; {System} Type SafeVar_typ = packed record week:byte; end; TSafeVar=class(TObject) Private hSafeVar:SafeVar_typ; Procedure wSafeVar(data:SafeVar_typ); Function rSafeVar(data:SafeVar_typ):SafeVar_typ; Public constructor create; destructor destroy; override; property data:SafeVar_typ read rSafeVar write wSafeVar; Published end; var SafeVar:TSafeVar; constructor TSafeVar.create; Begin inherited Create; fillchar(hSafeVar,sizeof(SafeVar_typ),chr(0)); End; destructor TSafeVar.destroy; Begin inherited destroy; End; Procedure TSafeVar.wSafeVar(data:SafeVar_typ); Begin WriteLn('Write'); End; Function TSafeVar.rSafeVar(data:SafeVar_typ):SafeVar_typ; Begin WriteLn('Read'); End; Begin SafeVar:=TSafeVar.create; SafeVar.data.week:=1; SafeVar.free; End. Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal