title: What are the differences between overriding virtual functions and hiding non-virtual functions?
body: <p>Given the following code fragment, what are the differences in the function calls? What is function hiding? What is function overriding? How do they relate to function overloads? What is the difference between the two? I couldn't find a good description of these in one place, so I'm asking here so I can consolidate the information.</p>
  
  <pre><code>class Parent {
    public:
      void doA() { cout &lt;&lt; "doA in Parent" &lt;&lt; endl; }
      virtual void doB() { cout &lt;&lt; "doB in Parent" &lt;&lt; endl; }
  };
  
  class Child : public Parent {
    public:
      void doA() { cout &lt;&lt; "doA in Child" &lt;&lt; endl; }
      void doB() { cout &lt;&lt; "doB in Child" &lt;&lt; endl; }
  };
  
  Parent* p1 = new Parent();
  Parent* p2 = new Child();
  Child* cp = new Child();
  
  void testStuff() {
    p1-&gt;doA();
    p2-&gt;doA();
    cp-&gt;doA();
  
    p1-&gt;doB();
    p2-&gt;doB();
    cp-&gt;doB();
  }
  </code></pre>