View Single Post
  #6 (permalink)  
Old 07-26-2008, 02:42 AM
Thor Thor is offline
Newbie
 
Join Date: Jul 2008
Posts: 1
Rep Power: 0
Thor is on a distinguished road
Default Re: function pointers

This is how to do it...
/Thor

Code:
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TFunctionPtr = function (P1: integer) : string;

function MyFunction(P1: integer): string;
begin
  result := IntToStr(P1);
end;

procedure Caller(Func: TFunctionPtr; Version: integer);
begin
  Writeln('My current Delphi version = ' + Func(Version));
end;

begin
  Caller(MyFunction, 10);
  Readln;
end.

Last edited by Thor; 07-26-2008 at 02:43 AM. Reason: CR/LF added
Reply With Quote