unit Unit2;interface
uses sysutils,classes,windows;
type
a=class
private
b:string;
public
constructor create(path:string);
destructor destroy;override;
end;
var aa:array of a;
implementationconstructor a.create(path:string);
begin
inherited create;
b:=path+';..';
end;
destructor a.destroy;
begin
inherited;
end;
end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,unit2;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
setlength(aa,6);
for i:=0 to 5 do
begin
aa[i].create('sdf');
end;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var i:integer;
begin
for i:=0 to 5 do
begin
aa[i].free;
end;
end;end.执行到 b:=path+';..'; 会出错,搞不懂。
uses sysutils,classes,windows;
type
a=class
private
b:string;
public
constructor create(path:string);
destructor destroy;override;
end;
var aa:array of a;
implementationconstructor a.create(path:string);
begin
inherited create;
b:=path+';..';
end;
destructor a.destroy;
begin
inherited;
end;
end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,unit2;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
setlength(aa,6);
for i:=0 to 5 do
begin
aa[i].create('sdf');
end;
end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var i:integer;
begin
for i:=0 to 5 do
begin
aa[i].free;
end;
end;end.执行到 b:=path+';..'; 会出错,搞不懂。
解决方案 »
- 请教:能否hint一个Form?
- 求delphi调用vs下c写的dll实例
- 关于 TObject 基础问题,
- 如何能很快的熟悉一个软件的流程
- 讨论写什么样的软件赚钱的群,,有兴趣的朋友可以加入!
- 我的电脑上安装了delphi7,打开时出现“应用程序正常初始化(0xc000005)失败”,请大虾帮忙。
- oracle中如何插入日期型数据?
- 谁有delphi6控件的属性,使用方法
- 求买这本绝版的书 DELPHI进销存程序设计(作者:陈惟彬) 谁有我愿意原价求购
- ---------------大派送(存储过程)=======================
- 关于clientdataset.loadfromfile问题
- 对于MyIE2、AvantBrowser之类浏览器的一点疑问。
b:string;
好像与b是私有的有关,你加两个函数
proterty b:string read readb write writeb;
至于这两个函数的编写,你看看任何一个类就知道了~~~