title: C++ Virtual Void vs no virtual
body: <p>I'm confused about virtual functions. I was told that virtual in parent class means I can override it in child class. However if I omit the virtual in parent class, I'm still able to override it.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class Enemy{
    public:
      //if I remove virtual, it still gets overriden in child class
    virtual void attack(){ 
  
      cout &lt;&lt; "Attack Enemy!" &lt;&lt; endl;
    }
  };
  
  
  class Minion : public Enemy {
    public:
    void attack(){
      cout &lt;&lt; "Attack Minon!" &lt;&lt; endl;
    }
  };
  int main() {
    Minion m;
    m.attack();
  }
  </code></pre>