[Issue 4435] New: Multiple-inheritance of Interfaces results in final/static method/function hijacking

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 7 07:34:49 PDT 2010


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

           Summary: Multiple-inheritance of Interfaces results in
                    final/static method/function hijacking
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: sandford at jhu.edu


--- Comment #0 from Rob Jacques <sandford at jhu.edu> 2010-07-07 07:34:47 PDT ---
Essentially, the first matching final/static function is chosen when a class
implements two interfaces with final/static methods:

interface Alive { final bool isDead() { return false; } }
interface Dead  { final bool isDead() { return true;  } }

class Cat1 : Alive, Dead {}
class Cat2 : Dead , Alive{}

void main(string[] args) {
    Cat1 c1 = new Cat1;
    Cat2 c2 = new Cat2;

    assert(!c1.isDead);
    assert( c2.isDead);
}

This seems to be another case of function hijacking. It may be similar in root
cause to bug 3706: delegates of interfaces with multiple inheritance fail

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