Since C++11 has been released, a lot of new things are added in newer versions of working draft (available at http://www.open-std.org/jtc1/sc22/wg21/). Recently I've come to know about the `override` keyword (which is not actually a `keyword` but an identifier with a special meaning).
A very good description with code example is given in this link below,
http://stackoverflow.com/questions/18198314/override-keyword-in-c
Key points are,
A very good description with code example is given in this link below,
http://stackoverflow.com/questions/18198314/override-keyword-in-c
Key points are,
- Works with virtual functions.
- The identifier `override` makes sure that the base class has the same function signature if you write override specifier after some virtual function in derived class.
-
Quoting working draft C++11 N3242 (published on 28-Feb-2011),
If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the program is ill-formed.
No comments :
Post a Comment