title: Is it okay to override (hide) a non-virtual method but still call it explicitly from a child class?
body: <p>Is it okay to override (hide) a non-virtual method but still call it explicitly from a child class? <a href="http://ideone.com/sobXR5" rel="nofollow">It works</a> but I don't know if it's compiler-specific or should be avoided for one reason or another. (I didn't expect it to work based on the terminology of "hiding" functions.)</p>
  
  <pre><code>class A
  {
  public:
      void foo()
      {
          cout &lt;&lt; "A::foo()" &lt;&lt; endl;
      }
  };
  
  class B : public A
  {
  public:
      void foo()
      {
          cout &lt;&lt; "B::foo()" &lt;&lt; endl;
          A::foo();
      }
  };
  
  int main()
  {
      B b;
      b.foo();
  }
  </code></pre>
  
  <hr>
  
  <h3>Edit</h3>
  
  <p>This might focus the question more.</p>
  
  <p>The parent's non-virtual method is in an infrastructure library we can't change, yet we need to derive a class that <em>hides</em> (not "overrides," as I've learned now) a function in favor of one that augments it (and calls the parent one explicitly en route). That is, the derived class <em>requires</em> this "augmented" function to be used in place of the parent one. <strong>Is this a valid scenario in which to hide a parent function?</strong></p>