main.pas
-------------------------------------
unit main;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,TFoo;
……………………procedure TForm1.Button1Click(Sender: TObject);begin
ShowMessage('NO');
tFoo.Create;
ShowMessage('OK"');
tFoo.a:= 123;
ShowMessage(IntToStr(tFoo.a));
tFoo.Free;
end;end.
------------------------------------------------
TFoo.pas
--------------------------------------------------
unit TFoo;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TFooa = class
private
Fa:integer;
function GetA() : Integer;
procedure SetA(a : Integer);
published
property a : Integer read GetA write SetA;
end;implementationfunction TFooa.GetA() : Integer;
begin
result :=Fa;
end;procedure TFooa.SetA(a : Integer);
begin
Fa :=a;
end;
end.
------------------------------------
程序运行到
tFoo.Create;
就出错了。不知道是为什么。
-------------------------------------
unit main;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,TFoo;
……………………procedure TForm1.Button1Click(Sender: TObject);begin
ShowMessage('NO');
tFoo.Create;
ShowMessage('OK"');
tFoo.a:= 123;
ShowMessage(IntToStr(tFoo.a));
tFoo.Free;
end;end.
------------------------------------------------
TFoo.pas
--------------------------------------------------
unit TFoo;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TFooa = class
private
Fa:integer;
function GetA() : Integer;
procedure SetA(a : Integer);
published
property a : Integer read GetA write SetA;
end;implementationfunction TFooa.GetA() : Integer;
begin
result :=Fa;
end;procedure TFooa.SetA(a : Integer);
begin
Fa :=a;
end;
end.
------------------------------------
程序运行到
tFoo.Create;
就出错了。不知道是为什么。
解决方案 »
- Delphi中访问FTP怎么设置PASV模式(新手提问,谢谢)
- 在Delphi中怎么用Tdatabase组件来访问数据库?谢谢帮助
- 程序运行时命令行和图形界面方式的统一
- DELPHI里面时间变量运算的问题,很急!!!!!!!
- 五个数据库小问题,请高手回答,谢谢,每个至少100分
- dbgrid中的问题
- 大家来提意见:你所知道的国内外好Delphi网站,作为资源共享!UP者有分!
- 接触delphi的时候,delphi已经日薄西山了
- 如何用一个sql语句。。。。
- 一个关于pascal基本语法的问题
- 请教如何实现内存画图,消除闪动?
- 请问 dbgrideh 和 cxgrid 这两 个控件 能否 实现 鼠标 经过 每一条数据行 时 改变 整行 的 底颜色 ????? 急!!!!!!!
procedure TForm1.Button1Click(Sender: TObject);
var Foo1:TFooa;
begin
ShowMessage('NO');
Foo1:=TFooa.Create;
ShowMessage('OK"');
Foo1.a:= 123;
ShowMessage(IntToStr(Foo1.a));
Foo1.Free;
end;