Function Pointer as a Field

BlitzMax Forums/BlitzMax Programming/Function Pointer as a Field

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

;))) Found this thread using the forum's search?
Well, here we are:
Type FuncPointerType
  Field Callback(foo%)

  Method Trigger()
     If Callback<>Null Then Callback(42)
  End Method
End Type

Function MyFunction(i%)
 Print "The answer is "+i
End Function

Global test:FuncPointerType=New FuncPointerType
test.Callback=MyFunction
test.Trigger()