[Issue 2525] override of function from abstract base class's interface

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 7 13:17:17 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=2525



--- Comment #5 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-07 13:17:16 PDT ---
(In reply to comment #4)
> A sloppy programmer works on new implementation of that
> functions and forgets that there is already existing one. However, code
> compiles and works, polluting sources with unused function body.

I agree 'override' adds to the readability, however D already protects you
against function hiding and function hijacking. For example:

-----
class A
{
    void foo() { }
}

class B : A
{
    void foo() { }
}
-----

test.d(10): Deprecation: overriding base class function without using override
attribute is deprecated (test.B.foo overrides test.A.foo)

I don't know why I wrote http://d.puremagic.com/issues/show_bug.cgi?id=2525#c2,
I do believe override makes the code more readable. Ideally we would have an
"implements" keyword, but you know, keyboard bloat and all that.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list