delphi函数参数问题
如下:
unit1中引用了unit2 unit3,unit2窗体类型TForm2,unit3窗体类型TForm3。现在unit1中要写一个打开窗体的函数
function TForm1.a(b : XX): TForm;
begin
result := b.create(application);
end;
form2 := a(TForm2);
form3 := a(TForm3);
Type
TMyForm = class of TForm;
type
TForm1 = class(TForm)
......
function TForm1.a(b: TMyForm): TForm;
begin
result := b.create(self);
end;
......
uses unit2 unit3;
.....
var
f: TForm;
begin
f := a(TForm2);
f.Show;
f := a(TForm3);
f.Show;
end;