delphi编程中如何使用函数指针呢?指针又又什么作用呢?看下面的文章: delphi中可以通过函数指针把一个函数作为参数来传递,然后在另外一个函数中调用。 1) 首先,申明函数指针类型TFunctionParameter。 type TFunctionParameter = function(const value : integer) : string; 2) 定义准备被作为参数传递的函数 function One(const value : integer) : string; begin result := IntToStr(value) ; end; function Two(const value : integer) : string; begin result := IntToStr(2 * value) ; end; 3) 定义将要使用动态函数指针参数的函数 function DynamicFunction(f : TFunctionParameter; const value : integer) : string; begin result := f(value) ; end; 4) 上面这个动态函数的使用实例 var s : string; begin s := DynamicFunction(One,2006) ; ShowMessage(s) ; //will display "2006" s := DynamicFunction(Two,2006) ; ShowMessage(s) ; // will display "4012" end;