title: c++ - <unresolved overloaded function type>
body: <p>In my class called <code>Mat</code>, I want to have a function which takes another function as a parameter. Right now I have the 4 functions below, but I get an error in when calling print(). The second line gives me an error, but I don't understand why, since the first one works. The only difference is function <code>f</code> is not a member of the class <code>Mat</code>, but <code>f2</code> is.
  The failure is: <code>error: no matching function for call to Mat::test( &lt; unresolved overloaded function type&gt;, int)'</code></p>
  
  <pre><code>template &lt;typename F&gt;
  int Mat::test(F f, int v){
      return f(v);
  }
  
  int Mat::f2(int x){
      return x*x;
  }
  
  int f(int x){
      return x*x;
  }
  
  void Mat::print(){
      printf("%d\n",test(f ,5));    // works
      printf("%d\n",test(f2 ,5));    // does not work
  }
  </code></pre>
  
  <p>Why does this happen?</p>