数组存放函数指针
type
TFunctionParameter = function(const value:Integer):string; //据我理解,这些就是函数指针;而且是没有函数名称的,换句话讲,匿名函数就是函数指针。
var
Form1: TForm1;
implementation
{$R *.dfm}
function One(const value:Integer):string;
begin
Result := IntToStr(value) + 'One';
end;
procedure TForm1.btn1Click(Sender: TObject);
var
A: array[0..2] of TFunctionParameter;
F: function(const value:Integer):string; //函数指针;有一个特别的地方,就是新建的函数指针的参数和返回值的数据类型要和One函数的数参和返回值的类型要一 一对应。
begin
A[0] := @One;
F := One;
ShowMessage(A[0](2016));
end;
参考:https://my.oschina.net/u/566587/blog/308811
http://www.cnblogs.com/leonkin/archive/2012/05/02/2479048.html