[Issue 4647] Cannot explicitly call final interface method, ambiguous calls allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 15 12:04:37 PDT 2010


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



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-15 12:04:34 PDT ---
Comment from Lukasz Wrzosek
>This:
>     app.Timer.run();            // error, no Timer property
>     app.Application.run();      // error, no Application property
>
>probably should be:
>    (cast(Timer)app).run();
>    (cast(Application)app).run();
>
>But app.run() is still ambiguous - should not compile.

I don't see why I would need a cast. I can explicitly call methods from
inherited classes, like so:

import std.stdio;

class Base
{
    void test() { writeln("Base.test()"); };
}

class Derived : Base
{
    override void test() { writeln("Derived.test()");}
}

class SecondDerived : Derived
{
}

void main()
{
    auto var = new SecondDerived;
    var.Base.test();      // calls Base.test()
    var.Derived.test();   // calls Derived.test()
}

So why shouldn't I be able to do the same with interfaces? TDPL allows it, I
think it should be allowed in DMD.

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