这个问题请教一下,老大给的时间快到了

jerremy1364 2004-05-11 04:27:22
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的数据类型,用什么类呢?
真是万分感谢
...全文
15 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

5,390

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧