首先,对于数组不能直接Read/Write
必须使用方法来进行(这在delphi的帮助上有明确的说明)
TClass = object
private
FNums:array[1..10] of LongInt;
procedure SetValue(Index:Integer; Value:LongInt);
function GetValue(Index:Integer):LongInt;
public
property Nums: array[1..10] of LongInt read GetValue write SetValue;
end;
procedure TClass.SetValue(Index:Integer; Value:LongInt);
begin
FNums[Index]:=Value;
end;
function TClass.GetValue(Index:Integer):LongInt;
begin
result:=FNums[Index];
end;
其次,对于类的指针,一定要分清类和类的实例,指向类的指针的区别