Thread overview
[Issue 2539] New: Base class methods are not envolved in interface methods implementation resolution
Dec 23, 2008
d-bugmail
Dec 26, 2008
d-bugmail
Jan 07, 2009
d-bugmail
Jan 07, 2009
d-bugmail
December 23, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2539

           Summary: Base class methods are not envolved in interface methods
                    implementation resolution
           Product: D
           Version: 2.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: 2korden@gmail.com


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.


-- 

December 26, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2539


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from bugzilla@digitalmars.com  2008-12-25 21:08 -------
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.


-- 

January 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2539


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #2 from smjg@iname.com  2009-01-07 15:13 -------
This has cropped up again as issue 2565, where it has quite rightly been changed to an enhancement request.  Changing to duplicate.


-- 

January 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2539


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE




------- Comment #3 from smjg@iname.com  2009-01-07 15:13 -------


*** This bug has been marked as a duplicate of 2565 ***


--