F
freisky
Unregistered / Unconfirmed
GUEST, unregistred user!
我自己写了一个简单的类,为什么调用的时候老是出问题呢?大家帮我看看,多谢啦! ^_^
这是类的代码:
unit Unit2;
interface
uses
SysUtils, Classes;
type
TT=class
private
FCount:integer;
protected
Procedure SetCount(value:Integer);
public
published
Property count:integer read FCount write SetCount default 0;
end;
implementation
Procedure TT.SetCount(value:Integer);
Begin
FCount:=value;
End;
end.
这里是调用的代码,是在另外一个unit里面调用的。
procedure TForm1.Button1Click(Sender: TObject);
var
t1:TT ;
begin
t1.count:=22;
self.Caption := IntToStr(t1.count);
end;
为什么在编译的时候总是提示Variable "t1" might not have been initialized.
而且一运行就出错呢?
这是类的代码:
unit Unit2;
interface
uses
SysUtils, Classes;
type
TT=class
private
FCount:integer;
protected
Procedure SetCount(value:Integer);
public
published
Property count:integer read FCount write SetCount default 0;
end;
implementation
Procedure TT.SetCount(value:Integer);
Begin
FCount:=value;
End;
end.
这里是调用的代码,是在另外一个unit里面调用的。
procedure TForm1.Button1Click(Sender: TObject);
var
t1:TT ;
begin
t1.count:=22;
self.Caption := IntToStr(t1.count);
end;
为什么在编译的时候总是提示Variable "t1" might not have been initialized.
而且一运行就出错呢?