Function Pointer Trouble

closed account (zb0S216C)
I have two structures: SOInterface and SOEntity. SOInterface contains this function pointer: void (*fpQueryState)(); and SOEntity contains this method: void QueryCurrState();

This is my program:

1
2
3
4
SOEntity SINewEntity;
SOInterface SINewInterface;
SINewInterface.fpQueryState = SINewEntity.QueryCurrState;
SINewInterface.fpQueryState();

On the 3rd line, I get this error:
argument of type 'void (SOEntity::)()' does not match 'void (*)()'

Ideas? Am I missing something?

Wazzak
Last edited on
Member pointers are not the same as function pointers, maybe this is your issue?
closed account (zb0S216C)
Now that you've said that, I dug a little bit deeper and found this parashift page: http://www.parashift.com/c++-faq-lite/pointers-to-members.html

Thanks for the assistance, LB.

Wazzak
Last edited on
Topic archived. No new replies allowed.