
n July 2009, the C++ standards committee voted into the
C++0x Working Paper new attribute tokens that regulate the overriding of virtual functions in a derived class. These
new attributes ensure that an overriding function matches its base class counterpart by signature and name.
As trivial as it may seem, overriding a virtual member function can go wrong in many ways, most of which go undetected by the compiler. This 10-Minute Solution shows how to use the new C++0x attributes to avoid a few common bugs associated with overriding virtual functions.

While overriding a virtual function, you accidentally misspell the function's name or inadvertently changed its parameter list. The compiler doesn't catch these bugs.

Add the [[base_check]], [[hiding]], and [[override]] attributes to your derived classes. This will help the compiler catch errors that are otherwise undetectable.