M
mycwcgr_bak
Unregistered / Unconfirmed
GUEST, unregistred user!
这么简单的生成对象也会出错?请问错误在什么地方?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type tbb=class
k:string;
end;
type taa=class
total:integer;
dimbb:array of tbb;
public
constructor create(input:integer);
end;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
mycw:taa;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ taa }
constructor taa.create(input: integer);
var
i:integer;
begin
total:=input;
setlength(dimbb,total);
//for i:=0 to total-1 do
begin
dimbb[1].Create;
dimbb[1].k:=inttostr(i);
//end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mycw:=taa.create(5);
//出现错误
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type tbb=class
k:string;
end;
type taa=class
total:integer;
dimbb:array of tbb;
public
constructor create(input:integer);
end;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
mycw:taa;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ taa }
constructor taa.create(input: integer);
var
i:integer;
begin
total:=input;
setlength(dimbb,total);
//for i:=0 to total-1 do
begin
dimbb[1].Create;
dimbb[1].k:=inttostr(i);
//end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mycw:=taa.create(5);
//出现错误
end;
end.