Here is what I have:
I have a few static member functions that belong to phi_menu class. I want them static just because they can be used on things other than menus (phi_menu instances).
static phi_menu::render_big_number(int number);// Renders big fonts on 16X2 LCD static phi_menu::render_regular_number(int number);// Renders regular size font on 16X2 LCD ...
Here is what I want to do: I want to use a pointer to call them:
phi_menu::get_user_input(current, min, max, step, (phi_menu::*update function));
Where the update function can be one of the above static member functions. So if I want to render large numbers I can pass pointer to render_big_number, or if I want regular number, I can pass pointer to the other function.
I tried many things, I admit I don't know much about member function pointers, I couldn't invoke the function.
Here is what I tried to invoke the member function with pointer: First I pass an address:
phi_menu::get_user_input(current, min, max, step, (&phi_menu::*render_big_number));
This line passed compiler (I think).
Next inside get_user_input I tried to invoke the member function:
(->update_function)(number); Error:expected primary-expression before '->' token. OK I don't have an instance but do I really need an instance for static member functions?
(fake->*update_function)(number); Same error. This time I thought I instantiated a "fake" in .h file.
Then I read up on "static member pointer being the same as regular function pointer" stuff. What does it mean? I used regular stuff before and it didn't work?!
C++ gurus please help! I was gonna release my phi_menu tonight but I couldn't. I really want a class wrapper around everything!
Thanks you! =( =( =(