Original Post
Okay, I''m sure this question has been asked a billion times, but I just can''t figure this out. Say I have some class like
class SomeClass
{
public:
void (* CurrentFunction)(void);
void Init(void);
void Blah(void);
private:
int Data;
};
SomeClass Test;
And then if you try to say something like
CurrentFunction = Init;
But then you get some conversion error, so you declare Init and Blah as static:
static void Init(void);
static void Blah(void);
and then this allows you to set CurrentFunction equal to one of these but then static function can''t access any member data of the class. So say then in Init() you want to set Data = 0:
void Init(void)
{
Data = 0;
}
This gives an error because static functions can''t access member data, nor do they have a this pointer. So then how do you do you have a class when a function pointer in it point to another function in the class so that the function its pointing to can access data in the class? Is this just impossible? I refuse to believe it, someone please help...