我構造類系統我該如何聲明一個數組屬性?
TTableSpec=class(Tobject)
private
FName : string;
FDescription : string;
FCan_add : Boolean;
FCan_edit : Boolean;
FCan_delete : Boolean;
FFields : array[1..100] of TFieldSpec;
public
property Name: String read FName;
property Description: String read FDescription;
property Can_add : Boolean read FCan_add;
property Can_edit : Boolean read FCan_edit;
property Can_delete : Boolean read FCan_delete;
property Fields : array read FFields;
end;
因此,在TableSpec Fields屬性應的字段的列表(I使用TFieldSpec數組)。如何組織字段(使用或不使用數組)的編譯後的結果列表中我收到一個錯誤
[Error] Objects.pas(97): Identifier expected but 'ARRAY' found
[Error] Objects.pas(97): READ or WRITE clause expected, but identifier 'FFields' found
[Error] Objects.pas(98): Type expected but 'END' found
[Hint] Objects.pas(90): Private symbol 'FFields' declared but never used
[Fatal Error] FirstTask.dpr(5): Could not compile used unit 'Objects.pas'
除非你確信你將需要整整100場,我想創建一個像類型'型中tfields = TFieldSpec'的數組,然後指定字段屬性爲'FFields:TFields'。 –
重命名標題,並刪除不相關的代碼。我們無需查看整個單元,以便在此查明問題。 –
您確定要使用數組類型的屬性,還是索引器? – CodesInChaos