title: Question about the member functions whose names are same
body: <p>Why this <a href="https://godbolt.org/z/e8vPezWdh" rel="nofollow noreferrer">code snippet</a> does not compile if there is a member method named <code>Derived::foo(int)</code>,</p>
  <pre><code>#include &lt;string&gt;
  
  class Base
  {
  public:
      int foo(int a, double b){return 0;}
      int foo(std::string a, double b){return 0;}
  };
  
  class Derived:public Base
  {
  public:
      int foo(int a){return 0;}
  
      int do_sth()
      {
          foo(2, 3.5);
  
          return 0;
      }
  };
  
  int main()
  {
  }
  </code></pre>
  <p>,whereas the code <a href="https://godbolt.org/z/sKsezTfWG" rel="nofollow noreferrer">snippet works</a> below well when commenting out the said function.</p>
  <pre><code>#include &lt;string&gt;
  
  class Base
  {
  public:
      int foo(int a, double b){return 0;}
      int foo(std::string a, double b){return 0;}
  };
  
  class Derived:public Base
  {
  public:
      //int foo(int a){return 0;}
  
      int do_sth()
      {
          foo(2, 3.5);
  
          return 0;
      }
  };
  
  int main()
  {
  }
  </code></pre>
  <p>Here is what the compiler complains about the former code snippet:</p>
  <pre><code>&lt;source&gt;: In member function 'int Derived::do_sth()':
  &lt;source&gt;:17:12: error: no matching function for call to 'Derived::foo(int, double)'
     17 |         foo(2, 3.5);
        |         ~~~^~~~~~~~
  &lt;source&gt;:13:9: note: candidate: 'int Derived::foo(int)'
     13 |     int foo(int a){return 0;}
        |         ^~~
  &lt;source&gt;:13:9: note:   candidate expects 1 argument, 2 provided
  </code></pre>
  <p>I think <code>foo(2, 3.5);</code> does exactly match the <code>Base::foo(int, double)</code>.It's amazing that the compiler complains about the former code snippet.</p>
  <p>But since the compiler is almost always right, so I must miss something. Could somebody shed some light on this matter?</p>