virtual function const vs virtual function non-const
<pre><code>class Base
{
   public:
   virtual void func() const
   {
     cout&lt;&lt;"This is constant base "&lt;&lt;endl;
   }
};

class Derived : public Base
{
   public:
   virtual void func()
   {
     cout&lt;&lt;"This is non constant derived "&lt;&lt;endl;
   }
};


int main()
{
  Base *d = new Derived();
  d-&gt;func();
  delete d;

  return 0;
}
</code></pre>

<p>Why does the output prints "This is constant base". However if i remove const in the base version of func(), it prints "This is non constant derived"</p>

<p>d->func() should call the Derived version right, even when the Base func() is const right ? </p>
