S
shaga
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的test过程该怎么写,才可以兼容b和c的调用?
TA = class
public
t1: string;
end;
TB = class(TA)
public
t2: string;
end;
TC = class(TA)
public
t2: string;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
Test(b);
Test(c);
end;
procedure TForm1.Test(a: TA);
begin
with a as TB do // 这里,由于with后面将进行大量的代码处理,不想copy一份给c来用
begin
ShowMessage(t2);
end;
end;
TA = class
public
t1: string;
end;
TB = class(TA)
public
t2: string;
end;
TC = class(TA)
public
t2: string;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
Test(b);
Test(c);
end;
procedure TForm1.Test(a: TA);
begin
with a as TB do // 这里,由于with后面将进行大量的代码处理,不想copy一份给c来用
begin
ShowMessage(t2);
end;
end;