帮我看看下面的代码?

czp 2001-12-15 01:50:34
为什么类的实例不能访问其实例字段?:
Type
TNj = record
njh: integer;
ydns: integer;
Njlx: integer;
njmc: string;
end;

TKs = record
ksmc: string;
ksh: integer;
kch: string;
end;

TNodeInf = class
private
fNj: TNj;
fKs: Tksary;

{ Private declarations }
public
// constructor Create(xqh,xqmc: string);
procedure SetNj(njmc: string; njh,ydns,Njlx: integer);
procedure SetKs(ksmc,kch: array of string; ksh: array of integer );

end;

implementation

procedure TNodeInf.SetNj(njmc: string; njh,ydns,Njlx: integer);
begin

fNj.njmc := njmc;
fnj.njh := njh;
fnj.ydns := ydns;
fnj.Njlx := Njlx;
end;
....

为什么我在建立该对象的实例后,通过其实例调用时:
NodeInfo.SetNj('dd',9,7,5) ;
总是Access violation at address 004862af in ...错误?
...全文
37 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

5,392

社区成员

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

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