News for hackers. Stuff that matters.
Re:We have C++14 by slavik81 on Tuesday August 19, 2014 @03:16PM (#8199212)
Those actually all return 4. Since f is virtual in the base class, it remains virtual in all derived classes, regardless of whether they say so explicitly.

The override keyword was added in C++11 to help prevent the sort of mistake you were trying to show. Any methods you mark with it will result in a compile error if they are not actually overriding anything.

For example, if B::g were marked as override, it would fail to compile because A::g is not virtual.

There are no comments on this comment yet.