Yesterday I wrote about the two methods I use to refactor a virtual function and make sure that I find all of the derived implementations. In the entry I lamented that I would like to have the C# keyword override implemented in C++. Well, apparently it is (at least in the Microsoft compiler)! Check it out for yourself on MSDN. Now since it was not a part of the language from the start, you cannot assume that when you change the super class's virtual function signature that the derived classes will not compile, but if you use the override keyboard keyword during development when you initially implement the derived classes, it will flag the mistake where you are creating a new virtual function instead of overriding an existing one.
So, let's take yesterday's classes and use the override keyword
class Base { public: virtual void Foo() {}; }; class Derived : public Base { public: virtual void Foo() override {}; };
main.cpp(6) : error C3668: 'Derived::Foo' : method with override specifier 'override' did not override any base class methods