Y
yahle
Unregistered / Unconfirmed
GUEST, unregistred user!
我设计了两个类Ta和Tb,其中Tb作为一个实体b存在于Ta类。
现在的问题是我无法使用实体b里面的函数,每次调用b.get就会出错。
谁能帮我看看,谢了。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
Tb = class
function get(i: integer):integer;
end;
type
Ta = class
b: Tb;
end;
var
Form1: TForm1;
a: Ta;
implementation
{$R *.dfm}
{ Tb }
function Tb.get(i: integer): integer;
begin
Result:= 0;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
showmessage(inttostr(a.b.get(1)));
end;
end.
现在的问题是我无法使用实体b里面的函数,每次调用b.get就会出错。
谁能帮我看看,谢了。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
Tb = class
function get(i: integer):integer;
end;
type
Ta = class
b: Tb;
end;
var
Form1: TForm1;
a: Ta;
implementation
{$R *.dfm}
{ Tb }
function Tb.get(i: integer): integer;
begin
Result:= 0;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
showmessage(inttostr(a.b.get(1)));
end;
end.