The override keyword can be used in C++ afterall (redux on refactoring virtual functions)

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 {}; };

Now when we change void Base::Foo() to void Foo(Bar* PBar), we get the following compiler error

     main.cpp(6) : error C3668: 'Derived::Foo' : method with override specifier 'override' did not override any base class methods

This is much better then the previous situation, although it is not as good as in the C# environment. If you forget to add the override keyword, you can still encounter the mistake of creating a new virtual function instead, but this is better then nothing!