Using std::thread to call functions from two Classes in C++11
0 I am trying to implement an API that should let the user create two communication channels in parallel. One channel uses TCP and the other uses UDP. I have two classes representing the two channels. These classes have different functions implemented. I would like the functions from the two channels to run in parallel. For that I am using std::thread to create two threads, one for each channel (class). The idea is the following following The header file looks like class Channel_1 public: int myfunc(int a, int b); ; class Channel_2 public: int anotherfunc(int a, int b); ; In the main cpp file include the header file int main() int a = 10, b = 20; Channel_1 ch1; Channel_2 ch2; std::thread t(ch1.myfunc, a,b); return 0; I get the error saying that no instance of the constructor std::thread exists. I have the following questions. Can't we call the functions from a class in the thread constructor? Does this idea of using threads for calling functions from differen