title: C++ Virtual function being hidden
body: <p>I'm having a problem with C++ inheritance.</p>
  
  <p>I have a class hierarchy:</p>
  
  <pre><code>class A {
  public:
     virtual void onFoo() {}
     virtual void onFoo(int i) {}
  };
  
  class B : public A {
  public:
      virtual void onFoo(int i) {}
  };
  
  class C : public B {
  };
  
  
  int main() {
      C* c = new C();
      c-&gt;onFoo(); //Compile error - doesn't exist
  }
  </code></pre>
  
  <p>My question is: why doesn't this compile?  My understanding is that C should inherit both onFoo functions from A - and in fact, this compiles if you remove the redefinition of onFoo in B - but g++ gives an error that C has no onFoo() function.</p>