1 (edited by rbknathan 2020-09-21 04:17:42)

Topic: Passing function as parameter to another function

I am trying to pass a function reference to another function. Any thoughts on how to achieve this ?

function add(a, b : integer) : integer;
begin
    Result := a + b;
end;

function sub(a, b : integer) : integer;
begin
    Result := a - b;
end;

function mul(a, b : integer) : integer;
begin
    Result := a * b;
end;

function action(a, b : integer; f : function) : integer;
begin
    Result := f(a,b);
end;

http://interactiveasp.net/blogs/spgilmo … -2010.aspx