请管理员介绍高手,想向他们请教问题 [email protected]
我想在自己的类中使用动态数组或动态内存
type
myclass=class
public
a: array of integer;
b: pinteger;
end;
....
var
mc: myclass;
begin
setlength(a,100);
Getmem(b,100);
end;
出现问题,不知应该怎样定义。另外,若b指针的第10个整数如何取得? 请高手指教 谢谢
我想在自己的类中使用动态数组或动态内存
type
myclass=class
public
a: array of integer;
b: pinteger;
end;
....
var
mc: myclass;
begin
setlength(a,100);
Getmem(b,100);
end;
出现问题,不知应该怎样定义。另外,若b指针的第10个整数如何取得? 请高手指教 谢谢
解决方案 »
- 修改文件名这样行吗?
- 非常著急的問題
- 进程状态问题
- 请问windows.GetTickCount是什么意思
- DELPHI 程序高手更好工作机会
- 时间问题
- 怎样屏蔽TWebBrowser的PopupWindow(注意,是自动弹出的,不是不能在新窗口中打开链接)
- 怎样防止DBGrid的隐性保存数据(即没调用POST,当光标点击当前行的前一行时发生)?
- 关于odbc的问题
- 编译没错误..运行时出现错误:Runtime error 6 at 004050C8..请问什么问题?
- 如何让Form上的组件例如Panel随着Form的大小的变化而变化呢?
- 哪里有或谁有 用DELPHI开的发双扣网络游戏,要求跟联众或边锋的差不多。
2 用b:=a[10];
在程序中declare这个类,并setlength,但在退出程序时有问题
另外您的
1 用a:Pinteger;
2 用b:=a[10];
不明白,pchar可以,但pinteger不可以
多谢指教,请再交流
先得mc=myclaas.create吧……
仍然有问题,加create也不行,在getmem时就出问题了
i:=Integer(Pinteger(Integer(b) + 9));
you are right,but the main problem is """getmem or setlength """var
mc: myclass;//??????????是否不能声明
begin
mc.create;
setlength(a,100);//出问题的地方在此行
Getmem(b,100);
end;
高手解答请发送到[email protected]
mc: myclass;
begin
mc := MyClass.Create;
with mc do
try
Setlength(a,100);
Getmem(b, 100);
finally
Free;
end;
end;