First type (class) I wrote in BlitzMax was a state machine that used function pointers...based on that experience here's my answers to your questions:
a) No, methods aren't static functions whose address can be stored off in a function pointer.
b) Yes, a function's address is static, and therefore can be assigned to a function pointer. Works great!
b1) Yes
b2) No
My suggestion is to use functions within Types. This keeps the encapsulation of the functionality within the type itself--you don't have misc free functions floating about. But, make the first argument to the function an Object. Then, inside the function, cast the object to the Type. You can now invoke type methods on this object.
This was my solution. It is reasonably elegant and works very well. Any type in my engine can now include (or inherit from) my state machine and have full state machine functionality. Whenever the machine changes states, functions inside your type will get called (each state supports a unique enter, exit, and update function). I've been waiting a long time for function pointers in Blitz, and I'm very glad they've arrived!
Ken
a) No, methods aren't static functions whose address can be stored off in a function pointer.
b) Yes, a function's address is static, and therefore can be assigned to a function pointer. Works great!
b1) Yes
b2) No
My suggestion is to use functions within Types. This keeps the encapsulation of the functionality within the type itself--you don't have misc free functions floating about. But, make the first argument to the function an Object. Then, inside the function, cast the object to the Type. You can now invoke type methods on this object.
This was my solution. It is reasonably elegant and works very well. Any type in my engine can now include (or inherit from) my state machine and have full state machine functionality. Whenever the machine changes states, functions inside your type will get called (each state supports a unique enter, exit, and update function). I've been waiting a long time for function pointers in Blitz, and I'm very glad they've arrived!
Ken