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.


Andrei

Reply via email to