[Issue 2524] New: final override inconsistent when implementing interfaces

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 18 13:16:10 PST 2008


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

           Summary: final override inconsistent when implementing interfaces
           Product: D
           Version: 1.038
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: schveiguy at yahoo.com


The following code builds:

interface I
{
  void foo();
}

class C : I
{
  override void foo();
}

But the following does not work:

class C : I
{
  final override void foo();
}

testfinaloverride.d(8): function testfinaloverride.C.foo does not override any
function

The two cases should be consistent.  The spec is unclear to me as to whether
implementing an interface function qualifies as overriding a function or not.

I would vote for the case where override requires either to override a base
class function or implement an interface function, since it is a pain if you
change a base class to an interface, you'd have to remove all the override
keywords.  So I'm marking it as rejects-valid.

The spec should also specifically lay out what override does in the case of
interfaces.


-- 



More information about the Digitalmars-d-bugs mailing list