我自己编写了一个类Loading,创建了它的一个实例x;当我调用x.create时,系统报告'Project Project1.exe raised exception class EStackOverflow with message'Stack overflow'.Process stopped.Use Step or Run to continue.'我把代码附上,请问这是我哪里写错了啊?程序原有一个单元Unit1,我新建了一个Unit2,内容如下:
unit Unit2;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs;type Loading=class //-----我的类
i:integer;
end;implementation------------------------------------
Unit1很简单,内容如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses unit2;{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var x:loading;//---------类的实例
begin
x.Create;//-----------这句话编译出错
x.i:=1;
x.Destroy;end;end.
end.
unit Unit2;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs;type Loading=class //-----我的类
i:integer;
end;implementation------------------------------------
Unit1很简单,内容如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses unit2;{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var x:loading;//---------类的实例
begin
x.Create;//-----------这句话编译出错
x.i:=1;
x.Destroy;end;end.
end.
解决方案 »
- delphi如何获取汉字拼音及音标?
- 【测试帖】散点分
- 高分求助各位:从三方软件内获得URL地址
- ★★★★★为张怡宁放分,只因她是我所喜欢的那种女孩儿....★★★★★
- 如何用代码实现取一张图片中的特定的东西,比如一张照片保留人物去掉背景。
- 我的程序需要控制用Modem建立的连接,请问如何挂断它
- 检测数据库存在问题(打包需要)
- oracle 8.1.6中为什么Enterprice Manager Console进不去,急急急!!!
- 请问有没有办法检测本机有没访问指定的网址?比如www.sina.com?
- delphi热键提示找不到窗体
- 如何注册DELPHI7?
- 用Tquery连接数据库时用户名和密码的问题
var x:loading;//---------类的实例
begin
x := Loading.Create; //-----------这样就不会编译出错啦
x.i:=1;
x.Free; //推荐你别直接用Destroy,永远都照BORLAND所说的那样,用Free来代替
end;
是一定不要直接使用Destroy
谢谢楼上两位!谢谢!!!!真的很感谢:)