Delphi 过程类型

unit Unit1;



interface



uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, Buttons;



type

  TForm1 = class(TForm)

    SpeedButton1: TSpeedButton;

    procedure SpeedButton1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;



var

  Form1: TForm1;



implementation



{$R *.dfm}

Type

  TMax=Function (a,b:integer):integer;

Function twoMax(a,b:integer):integer;

 begin

   Result:=a+b;

 end;

Function MaxTwo(i,y:integer;Tom:TMax):integer;

 begin

   Result:=tom(i,y);

 end;

procedure TForm1.SpeedButton1Click(Sender: TObject);



begin

  ShowMessage(INTTOSTR(twomax(10,15))+'='+INTTOSTR(MaxTwo(10,15,twomax)));

end;



end.

Delphi 过程类型

你可能感兴趣的:(Delphi)