为什么出错
自定义一个类,但出错,我是凭c++的经验写的,可能有什么不对
type
.......
TPlate=class
public
Width,Height:byte;
constructor Create(tWidth,tHeight:byte);
end;
implementation
constructor 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;