I use non-static method pointers inside classes all the time, but this is how I do it… Let me just whip up a code example, make a blank console app and put this in it to run it…
[code]#include
class mainbase
{
public:
void toPrint()
{
printf(“The mainbase Class is talking.\n”);
}
protected:
private:
};
typedef void (testFunc)(void, int);
class testBase
{
public:
testBase()
{
theFunc = 0;
}
void doCommand(unsigned long theCommand)
{
printf("Calling a function now");
if(theFunc!=0)
theFunc(this,theCommand);
else
printf("theFunc was zero?\n");
}
testFunc theFunc;
};
class testClass : public mainbase, public testBase
{
public:
testClass() : testBase()
{
theFunc = (testFunc)aFunc;
}
static void aFunc(testClass *self, int testInt)
{
printf("a test phrase, now to call toPrint on me :)\n");
if(self!=NULL)
self->toPrint();
else
printf("self was empty? the wha?");
}
void toPrint()
{
printf("The testClass Class is talking.\n");
}
};
int _tmain(int argc, _TCHAR* argv[])
{
testClass theTest;
theTest.doCommand(12);
printf("\n\n");
return 0;
}[/code]
This is an example I made for someone else showing a few class things, along with pointing to class methods. All you have to do is just have teh delegate have a void* for it’s first param, and anytime you want to call it, just pass the class as the first param as shown above. Albeit it, this example it is a static, but you can set it up to be a normal one as well following the same method, do note you get compilier warnings about such actions so it’s good to pragma those out for that file. 