自定义一个类,但出错,我是凭c++的经验写的,可能有什么不对type
....... TPlate=class
public
Width,Height:byte;
constructor Create(tWidth,tHeight:byte);
end;implementationconstructor TPlate.Create(tWidth,tHeight:byte);
begin
Width:=tWidth;
Height:=tHeight;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
p1,p2:TPlate;
begin
p1.Create(1,2);
p2.Create(3,4); //执行至此出错,代码窗口下方提示p1,p2尚未初始化 showmessage(inttostr(p1.Width));
showmessage(inttostr(p1.Height));
end;
....... TPlate=class
public
Width,Height:byte;
constructor Create(tWidth,tHeight:byte);
end;implementationconstructor TPlate.Create(tWidth,tHeight:byte);
begin
Width:=tWidth;
Height:=tHeight;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
p1,p2:TPlate;
begin
p1.Create(1,2);
p2.Create(3,4); //执行至此出错,代码窗口下方提示p1,p2尚未初始化 showmessage(inttostr(p1.Width));
showmessage(inttostr(p1.Height));
end;
解决方案 »
- TreeView与数据库连接问题,请前辈赐教
- 关于idTCPServer转发数据(100分送上)
- 我用了很多种GB转成BIG5的方法将简体转成繁体方法。但是在简体操作系统下看起来是繁体的,在繁体操作系统下看起来就是乱码
- 字符串函数leftstr()问题
- RichEdit关于打字速度测试的问题?
- 客户端用ADOConnection连接服务器,如何可以不在网上邻居先登录?????
- 数据库共享问题
- 谁知道如何操作网盘?
- 关于数据库性能问题
- 谁能做出动画显示Label的效果,就像动画显示窗体一样(AnimateWindow(form2.Handle,500,AW_BLEND or AW_CENTER);)
- 散点分,不要问为什么!
- 119急救请教高手
p1,p2:TPlate;
begin
p1:= TPlate.Create(1,2);
p2:= TPlate.Create(3,4); showmessage(inttostr(p1.Width));
showmessage(inttostr(p1.Height));
end;