unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ComCtrls, StdCtrls;
type
TFunc = procedure() of object;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function myTest(f:TFunc):string;
procedure abc();
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.abc;
begin
showmessage('这是回调函数测试');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
myTest(abc);
end;
function TForm1.myTest(f:TFunc):string;
begin
f();
end;
end.