Usually you use a function pointer variable. For instance:
type
TProcedure = procedure;
procedure MyProc1;
begin
end;
procedure MyProc2;
begin
end;
var
Proc: TProcedure;
.....
Proc := MyProc1;
Proc();//calls MyProc1
Proc := MyProc2;
Proc();//calls MyProc2
This is the simplest example. You can specify procedural types containing a list of parameters, an object type method, etc. For more information, see Procedural Types in the Language Guide.
source
share