没有这样的函数,不过你可以定义一个方法对象实现类似的功能
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TMyFun=procedure of Object; //定义一个方法类
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure A1; //函数A1
procedure A2; //函数A2
procedure A3; //函数A3
procedure ExecFun(Fun:TMyFun); //执行方法
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.A1;
begin
showmessage('A1');
end;
procedure TForm1.A2;
begin
showmessage('A2');
end;
procedure TForm1.A3;
begin
showmessage('A3');
end;
procedure TForm1.ExecFun(Fun:TMyFun);
begin
Fun();
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ExecFun(A1);
ExecFun(A2);
ExecFun(A3);
end;
end.