program Project2; {$APPTYPE CONSOLE} uses SysUtils; type //定义一个对象事件方法 TCallbackFunc = function (i: Integer): Integer of object; TMyCallBackObject = class private FcallBack: TCallbackFunc; function SetcallBack(const Value: TCallbackFunc): Integer; pub…
用法一 Type TProc=procedure() of object; procedure Callback(proc:TProc); begin ... end; procedure myproc() begin ... end; Callback(myproc); 用法二 type TProc= reference to Procedure(); procedure Callback(proc:TProc); begin .... end; Callback( procedure()be…