I'd like to know this too.
Guess the best way to find out is just to experiment. I know you can set a pointer inside of an object to a function outside of the object. I don't know about 'Method Pointers' though.
When setting up a function pointer you have to make sure the signatures match:
*this code is untested, I just put it there to show how to use the function pointers.*
Hope this helps.
Guess the best way to find out is just to experiment. I know you can set a pointer inside of an object to a function outside of the object. I don't know about 'Method Pointers' though.
When setting up a function pointer you have to make sure the signatures match:
*this code is untested, I just put it there to show how to use the function pointers.*
Type foo 'Declare Function Pointer 'This can be any name, I just chose the text 'FunctionPointer' 'for demonstration purposes. Field FunctionPointer(Sender:foo) Field Name$ Field Age Function Create:foo(Name$, Age) Local f:foo = new foo f.Name = Name; f.Age = Age return f End Function Method Update() 'Check if the function pointer has been assigned. If FunctionPointer <> null Then 'If so, call the function and pass the parameters FunctionPointer(Self) End If Print "Name: " + Name Print "Age: " + Age End Method End Type Function FooFunction(Sender:foo) 'Sender refers to the current foo object that's 'calling this function. Sender.Age:+25 End Function Local f:foo = foo.Create("Jim",39) f.FunctionPointer = FooFunction f.Update() Should print: Name: Jim Age: 64
Hope this helps.