override will eventually be required when overriding a function. It is already if you compile with -w but not yet all of the time - though since protected isn't virtual and isn't really overriding anything, the compiler doesn't complain if you don't use override with it (though it will if you do, since it's not overriding anything). So, eventually (or now if you use -w), you will _always_ know whether a function is overiding another or not, because it will
have to have override if it is and can't have it if it isn't.

- Jonathan M Davis

That's good to know. I'll start using -w from now on.
However, the problem still exists that if a function is meant to override a virtual method, but the method is not actually virtual, and the programmer forgets to type "override," the compiler won't complain and the error will slip through.


Reply via email to