title: Overriding non-virtual methods
body: <p>Let's assume this scenario in Visual C++ 2010:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  
  using namespace std;
  
  class Base
  {
  public:
      int b;
      void Display()
      {
          cout&lt;&lt;"Base: Non-virtual display."&lt;&lt;endl;
      };
      virtual void vDisplay()
      {
          cout&lt;&lt;"Base: Virtual display."&lt;&lt;endl;
      };
  };
  
  class Derived : public Base
  {
  public:
      int d;
      void Display()
      {
          cout&lt;&lt;"Derived: Non-virtual display."&lt;&lt;endl;
      };
      virtual void vDisplay()
      {
          cout&lt;&lt;"Derived: Virtual display."&lt;&lt;endl;
      };
  };
  
  int main()
  {
      Base ba;
      Derived de;
  
      ba.Display();
      ba.vDisplay();
      de.Display();
      de.vDisplay();
  
      _getch();
      return 0;
  };
  </code></pre>
  
  <p>Theoretically, the output of this little application should be:</p>
  
  <ul>
  <li>Base: Non-virtual display.</li>
  <li>Base: Virtual display.</li>
  <li><strong><em>Base: Non-virtual display.</em></strong></li>
  <li>Derived: Virtual display.</li>
  </ul>
  
  <p>because the Display method of the Base class is not a virtual method so the Derived class should not be able to override it. Right?</p>
  
  <p>The problem is that when I run the application, it prints this:</p>
  
  <ul>
  <li>Base: Non-virtual display.</li>
  <li>Base: Virtual display.</li>
  <li><strong><em>Derived: Non-virtual display.</em></strong></li>
  <li>Derived: Virtual display.</li>
  </ul>
  
  <p>So either I didn't understand the concept of virtual methods or something strange happens in Visual C++.</p>
  
  <p>Could someone help me with an explanation?</p>