C++ member function overloading with & (ampersand)

Viewed 2367

How to pick the correct error() member function? Do I need to cast somehow?

using namespace std;

struct test
{
   int error();
   void error(int x);
   int fun();
};

int main() {
   auto f1 = &test::error; // how to pick the correct function?
   auto f2 = &test::fun; // works
}
5 Answers
Related