c++ , pthread and static callbacks. “this” returns a pointer to the base class inctead of the derived one [duplicate]
问题 This question already has an answer here : c++ , pthread and static callbacks. “this” returns a pointer to the base class inctead of the derived one (part 2) (1 answer) Closed 3 years ago . I am using as basis this cpp thread class. This I use as a base class for threads. Note that in my case Thread::main() is a virtual function (unlike in the link). So I basically use: class Thread { public: virtual void main() { cout << "This should not be run once derived and redefined." << endl; } void