Why do I sometimes see in C++ examples when talking about subclassing / inheritance, the base class has virtual keyword and sometimes the overridden function has also the virtual keyword, why it's necessary to add to the subclass the virtual key word sometimes? For example:
class Base
{
Base(){};
virtual void f()
......
}
};
class Sub : public Base
{
Sub(){};
virtual void f()
...new impl of f() ...
}
};