C++11 added override
to ensure that member functions you write that you intend to override base-class virtual functions actually do (or won\'t compile).
GCC and Clang are covered by other answers. Here's same for VC++ from my other answer:
Below are the relevant warning numbers in VC++:
C4263 (level 4) 'function': member function does not override any base class virtual member function
C4266 (level 4) 'function': no override available for virtual member function from base 'type'; function is hidden
To enable these two warnings, you can use one of following options:
Enable above two warnings using code.
#pragma warning(default:4263)
#pragma warning(default:4266)
Enable above two warnings in project settings > C/C++ > Command Line and then enter /w34263 /w34266. Here /wNxxxx option means enable xxxx warnings in Level N (N = 3 is default level). You can also do /wdNxxxx which disables the xxxx warning in level N.