You have to distinguish between overriding and overloading. Without the virtual
keyword you only overload a method of a base class. This means nothing but hiding.
Let's say you have a base class Base
and a derived class Specialized
which both implement void foo()
. Now you have a pointer to Base
pointing to an instance of Specialized
. When you call foo()
on it you can observe the difference that virtual
makes: If the method is virtual, the implementation of Specialized
will be used, if it is missing, the version from Base
will be chosen.
It is best practice to never overload methods from a base class. Making a method non-virtual is the way of its author to tell you that its extension in subclasses is not intended.