Does the 'update' function need to do anything to the 'Power' object? If it's static, it might as well be outside of the class. You can make it work the other way if you change 'setFunction' to
Code:
//Put this before Timer
class Power;
//Within the Timer class
void setFunction(Power *power, void *(Power:: *fun)());
This will allow you to tie the Timer directly to the Power object. Then change the 'setFunction' call to
Code:
t.setFunction(this, &Power::update);
When you call the function from Timer, call it like this
That will make sure the Power object that called 'setFunction' will get the function call (i.e. you can update information within the Power object in the 'update' function.) If you leave it static, none of the Power objects will get the call; it will be like calling a global function.
You should always use '&' when giving a function pointer argument just out of good form, and you should also qualify even static functions with the class name, just in case.
ta0kira
PS dmail: OP is using a private function pointer, however OP provides it from within the class so there is no need for friends or making the function public. I do agree that 't' should be private as well, however.