Bug 2539 – Base class methods are not involved in interface methods implementation resolution

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-12-22T18:55:00Z
Last change time
2015-06-09T01:20:50Z
Assigned to
bugzilla
Creator
2korden

Comments

Comment #0 by 2korden — 2008-12-22T18:55:22Z
Here is the code: class A { int b() { return 42; } } interface B { int b(); } class C : A, B { // test.d(13): class test.C interface function B.b is not implemented } While it is usually not an issue, since you can simply add "int b() { return super.b(); }" to class C, it is not in my case: class A { final int b() { return 42; } // note the 'final' } interface B { int b(); } class C : A, B { int b() { return super.b(); } } test.d(15): function test.C.b cannot override final function test.A.b I believe this needs to be discussed.
Comment #1 by bugzilla — 2008-12-25T21:08:55Z
This is working as designed. Base class methods are deliberately not considered when adding interfaces to derived classes. As for it being final in the base class, the base class designer gets to say what is final and what isn't for base class methods. It would defeat the whole purpose to allow overriding a final method.
Comment #2 by smjg — 2009-01-07T15:13:34Z
This has cropped up again as issue 2565, where it has quite rightly been changed to an enhancement request. Changing to duplicate.
Comment #3 by smjg — 2009-01-07T15:13:55Z
*** This bug has been marked as a duplicate of 2565 ***