On 8/30/11 7:45 AM, Steven Schveighoffer wrote:
On Tue, 30 Aug 2011 08:26:17 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:

On 08/30/2011 07:13 AM, Timon Gehr wrote:
If there already is an implementation, it overrides it, otherwise it
implements it.

That's pretty much it. The entire purpose of the "override" keyword is
to prevent silent bugs of two kinds:

(a) User thinks she hooks a specific method but instead introduces a
new one.

(b) User thinks she introduces a new method but instead hooks one.

Override helps only in cases where otherwise a silent error would
occur. If the compiler issues an error message without the help of
override, override is unneeded and illegal. This is the case with
interface and abstract methods - "override" is emphatically unneeded
because the compiler/linker wouldn't allow the code anyway.

Your (a) and (b) points seem to be pointing to a different conclusion --
that override should be required for interface methods.

No, because the compiler rejects code that doesn't implement all methods of an interface.

Andrei

Reply via email to