关于delphi属性.有个可进行读写的属性.
谁可以给一个例子,在给一个只能读不能些的例子.然后就是属性的存储,谁可以给一个<Stored Flase/true>Default属性默认值<NoDefault>例子
我自己写了一个默认值的但是没效果谢谢各位高手了接触delphi没几天

解决方案 »

  1.   

    TMyClass=class(Tobject)
    private
      FField1:Integer;
      FField2:string;
      FField3:string;
      FRecords:TList;
      function GetField3 :string;
      procedure SetField3(const value:string);
      function GetRecord(index: Integer): TMyRecord ;
      procedure SetRecord(index: Integer; const Value: TMyRecord );
      //这俩函数是操作FRecords
    public
      property Records[index:Integer]:TMyRecord read GetRecord write SetRecord; default;//默认 可以直接 对象名[i]来取FRecords[i]
    published
      property Field1: Integer read FField1 write FField1;
      property Field2: String read FField2 ;//只读
      property Field3: String read GetField3 write SetField3;//通过GET和SET函数读写
    数组属性好象最好放public里
    其他楼下补充
      

  2.   

    至于值的默认值大概这样
    property Tag: Longint read FTag write FTag default 0;