function GetChildData(AOwner: TCompoment
var Data1, Data2: string): Boolean;
begin
with TChildForm.Create(AOwner) do
try
Result := ShowModal = mrOK;
if Result then
begin
Data1 := Edit1.Text;
Data2 := Edit2.Text;
end;
finally
Free;
end;
end;
A中的Perform方法式至如下
class function String Perform;
begin
with TClassA.Create(Nil) do
try
//do something
if ShowModel = mrOk
then Result := some value
else Result := other value;
finally
Free;
end;
end;