假设我有:
class Base
{
public:
void operator()()
{
this->run();
}
virtual void run () {}
}
class Derived : public Base
{
public:
virtual void run ()
{
// Will this be called when the boost::thread runs?
}
}
int main()
{
Base * b = new Derived();
boost::thread t(*b); // <-- which "run()" function will be called - Base or Derived?
t.join();
delete b;
}
根据我的测试,我无法Derived::run()
被召唤。我做错了什么,还是这是不可能的?