Pointers to a function in Delphi?
Posted on 2008-06-10
I have an object, that sometimes needs to make a call to a function, and that function can be one of many. So i need to be able to tell the object what function it should use "this time". How do i:
(1) Make a var that holds the adress to a function.
(2) Tell the object what adress the function now have.
Im thinking like this:
// the function
function MyValue : integer
result = 10;
// the objec
procedure MyObject.SetFunction (p : funcpointer);
use p, how?