这个问题请教一下,老大给的时间快到了
TOperatorRight = class
public
OperatorNo: String;
ModuleNo: integer;
TypeNo: integer;
HasRight: integer;
end;
TOperatorRights = class
private
FItems: TList;
function GetItem(index: integer): TOperatorRight;
public
constructor Create;
destructor Destroy; override;
procedure Add(Source: TOperatorRight);
property Items[Index: integer]: TOperatorRight read GetItem;
end;
在上面的两个类中,TOperatorRights 的GetItem方法是这样写的
function ToperatorRights.GetItem(index: integer): TOperatorRight;
egin
if (index >= 0) and (index <= Count -1 ) then
result := TOperatorRight(FItems[index])
else
raise Exception.Create('发生异常');
end;
想返回类型为TOperatorRight,编号为index的对象,但是运行到这一句就会报地址错,真的不知道什么原因,怎样实现呢?改变FItems的数据类型,用什么类呢?
真是万分感谢