[Issue 3759] New: Implementing two interfaces with same final function is accepted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 31 10:05:32 PST 2010


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

           Summary: Implementing two interfaces with same final function
                    is accepted
           Product: D
           Version: 2.040
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ary at esperanto.org.ar


--- Comment #0 from Ary Borenszweig <ary at esperanto.org.ar> 2010-01-31 10:05:31 PST ---
import std.stdio;

interface One {

  final void foo() {
    writefln("One");
  }

}

interface Two {

  final void foo() {
    writefln("Two");
  }

}

class X : One, Two {
}

class Y : Two, One {
}

void main() {
  X x = new X();
  x.foo(); // prints "One"
  Y y = new Y();
  y.foo(); // prints "Two"
}
---

This might lead to bugs. I think this should be a compile-time error. I don't
know how to solve this issue if you do want to implement both interfaces.

-- 
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