title: Derived class overriding base class functions again
body: <p>In <a href="https://stackoverflow.com/questions/1628768/why-does-an-overridden-function-in-the-derived-class-hide-other-overloads-of-the">this</a> thread the author of the accepted answer explains why the overridden method in the derived class can not be resolved by the compiler. However the example is relative to a type cast resolution, that is both the base and derived overloaded method have one parameter only and the ambiguity is limited to that parameter type.</p>
  
  <p>But where is the ambiguity when the overloaded methods have a different number of parameters, like in this example?</p>
  
  <p><strong>Note that I'm not asking why the example produces a compile error, I'm asking why the language was designed this way.</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class A
  {
  public:
     inline int f(int x) { return x; }
  };
  
  class B: public A
  {
  public:
     inline int f(int x, int y) { return x+y; }
  };
  
  
  int main()
  {
    B b;
  
    cout &lt;&lt; b.f(1) &lt;&lt; endl; // COMPILE ERROR
    cout &lt;&lt; b.f(1,2) &lt;&lt; endl;
  }
  </code></pre>