title: Overriding vs Virtual
body: <p>What is the purpose of using the reserved word virtual in front of functions? If I want a child class to override a parent function, I just declare the same function such as <code>void draw(){}</code>. </p>
  
  <pre><code>class Parent { 
  public:
      void say() {
          std::cout &lt;&lt; "1";
      }
  };
  
  class Child : public Parent {
  public:
      void say()
      {
          std::cout &lt;&lt; "2";
      }
  };
  
  int main()
  {
      Child* a = new Child();
      a-&gt;say();
      return 0;
  }
  </code></pre>
  
  <p>The output is 2. </p>
  
  <p>So again, why would the reserved word <code>virtual</code> be necessary in the header of <code>say()</code> ?</p>
  
  <p>Thanks a bunch.</p>