title: Reason for C++ member function hiding
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5928535/name-hiding-and-fragile-base-problem">name hiding and fragile base problem</a>  </p>
  </blockquote>
  
  
  
  <p>I'm familiar with the rules involving member function hiding.  Basically, a derived class with a function that has the same name as a base class function doesn't actually overload the base class function - it completely hides it.</p>
  
  <pre><code>struct Base
  {
      void foo(int x) const
      {
  
      }
  };
  
  struct Derived : public Base
  {
      void foo(const std::string&amp; s) { }
  };
  
  
  int main()
  {
      Derived d;
      d.foo("abc");
      d.foo(123); // Will not compile! Base::foo is hidden!
  }
  </code></pre>
  
  <p>So, you can get around this with a <code>using</code> declaration.  But my question is, what is the reason for base class function hiding?  Is this a "feature" or just a "mistake" by the standards committee?  Is there some technical reason why the compiler can't look in the Base class for matching overloads when it doesn't find a match for <code>d.foo(123)</code>?</p>