title: C++ override inherited methods
body: <p>I have the following two classes. Since <code>Child</code> inherits from <code>Father</code>, I think that <code>Child::init()</code> overrides <code>Father::init()</code>. Why, when I run the program, I get "I'm the Father" and not "I'm the Child"? How to execute <code>Child::init()</code>?</p>
  
  <p>You can test it here: <a href="https://ideone.com/6jFCRm" rel="noreferrer">https://ideone.com/6jFCRm</a></p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class Father {
      public:
          void start () {
              this-&gt;init();
          };
  
          void init () {
              cout &lt;&lt; "I'm the father" &lt;&lt; endl;
          };
  };
  
  class Child: public Father {
      void init () {
          cout &lt;&lt; "I'm the child" &lt;&lt; endl;
      };
  };
  
  int main (int argc, char** argv) {
      Child child;
      child.start();
  }
  </code></pre>