请看下面的代码?执行时报错:“stack overflow”我用F7 Trace into,发现执行到fillItem1.Create(0,'test','Test');一句时就会陷入循环,一直执行该句不会往下运行,不知这是为什么啊?unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TFillItem= class
No:Integer;
Title:string;
Content:string;
constructor create(_No: Integer;_Title: String;_Content:String);
end; TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
MyList:TStrings;implementation{$R *.DFM}
Constructor TFillItem.Create(_No: Integer;_Title: String;_Content: String);
begin
No:=_No;
Title:=_Title;
Content:=_Content;
end;procedure TForm1.FormCreate(Sender: TObject);
var
fillItem1: TFillItem;
begin
MyList := TStringList.create;
fillItem1.Create(0,'test','Test');
MyList.AddObject('test0', fillItem1);end;end.
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TFillItem= class
No:Integer;
Title:string;
Content:string;
constructor create(_No: Integer;_Title: String;_Content:String);
end; TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
MyList:TStrings;implementation{$R *.DFM}
Constructor TFillItem.Create(_No: Integer;_Title: String;_Content: String);
begin
No:=_No;
Title:=_Title;
Content:=_Content;
end;procedure TForm1.FormCreate(Sender: TObject);
var
fillItem1: TFillItem;
begin
MyList := TStringList.create;
fillItem1.Create(0,'test','Test');
MyList.AddObject('test0', fillItem1);end;end.
fillItem1:=TfillItem.Create(0,'test','Test');