在Classes.pas中有如下定义
TStringListSortCompare = function(List: TStringList; Index1, Index2: Integer): Integer;
我不知道其中的函数具体是怎么实现的,如何进行工作的,请赐教!

解决方案 »

  1.   

    这是定义一个函数,函数的返回值为整型
    函数有三个参数
    第一个参数为TStringList类型自定义排序算法 
      

  2.   

    相当于
    function TStringListSortCompare(List: TStringList; Index1, Index2: Integer): Integer;
      

  3.   

    //定义函数的格式
    TStringListSortCompare = function(List: TStringList; Index1, Index2: Integer): Integer;TStringList类中,有如下成员函数:
    procedure QuickSort(L, R: Integer; SCompare: TStringListSortCompare);如果你想调用QuickSort这个过程,必须传入第三个参数,这个参数是一个指向函数的指针类型.具体的实现函数,你可以自己写,比如:
     
    function MyFun(List: TStringList; Index1, Index2: Integer): Integer;
    begin
      //.......
      Result := 0;
    end;调用QuickSort时,传入函数的名称(这里是MyFun)就行.
      

  4.   

    楼上说的我也知道,我就不明白,该函数有没有具体实现部分,他具体是如何运作的
    谢谢你的回答
    就是如下定义是怎么运作的
    Type
      TxxxxB = Function(xx:TxxA,i:Integer):TxxC;