Edit: The correct title should have been "Calling overloaded true virtual function in base class", as that was a big part of the problem.
I have a base class with a true virtual function and a couple of other, normal ones. One of the normal ones calls the virtual function in a thread, and I get an error in that line, which I don't understand. I guess it has something to do with the thread, but as the base class is abstract, and every derived class has to actually implement the virtual function, there should be no problem. Maybe it's something completely different. This is more or less what it looks like:
class Base {
virtual int getInfo(int a) = 0; // the culprit?
void getInfo(); // is implemented, calls getInfo(int); Does
// actually have the same name. Works perfectly fine.
void getThreadedInfo(); // for details, see below
}
// ..later..
Base::getThreadedInfo() {
...
for(int i=0; i<maxThreads; i++) {
threads.push_back(thread(getInfo, i)); // this is line 85
}
...
}
The complete error message is:
Error 1 error C3867: 'Base::getInfo': function call missing argument list; use '&Base::getInfo' to create a pointer to member
c:\path\to\base.cpp 85 1 Project
Error 2 error C2661: 'std::thread::thread' : no overloaded function takes 2 arguments
c:\path\to\base.cpp 85 1 Project