type
TObj = class
private
FNumber: Integer;
public
property Number: Integer read FNumber;//只读属性,不可写
end;
procedure TForm1.FormCreate(Sender: TObject);
var
O: TObj;
begin
O := TObj.Create;
PInteger(@O.Number)^ := 2;//通过指针的方式访问
ShowMessageFmt('%d', [O.Number]);
O.Free;
end;