Class A
{
B *pB; //assume its pointing to an B
void somefunc() //This will be called by the user or something else
{
B.Start(&A::TheEvilFunc, this);
};
TheEvilFunc(std::string);
}
};
class B
{
struct X
{
A *pA;
void (A::*pFunc)(std::string);
};
void Start(void (A::*pfunc)(std::string), A* pA)
{
X THEX;
THEX.pFunc = pfunc;
THEX.pa = pa;
CreateThread(NULL, 0, SomeThreadFunc, THEX , 0, NULL);
}
friend DWORD WINAPI SomeThreadFunc(void*);
}
DWORD WINAPI SomeThreadFunc(void* v)
{
//blabla
X x; //assume its been assigned v
///////////////////// Now how to call the pFunc?
(x.pClient)->*(x.pFunc(strRecvd)); ///Here goes the error
}