You need to pass two things: a pointer-to-member, and the object. You cannot call a non-static member function (like Gamma
) in C++ without an object. The correct syntax would be:
std::thread gamma_thread(&Beta::Gamma, // the pointer-to-member
my_beta, // the object, could also be a pointer
5); // the argument
You can think of my_beta
here as being the first argument to Gamma()
, and 5
as the second.