Dnia 2010-08-15, o godz. 17:32:42 d-bugm...@puremagic.com napisaĆ(a): > http://d.puremagic.com/issues/show_bug.cgi?id=4647 > > Summary: Cannot explicitly call final interface method, > ambiguous calls allowed > Product: D > Version: D2 > Platform: Other > OS/Version: Windows > Status: NEW > Severity: normal > Priority: P2 > Component: DMD > AssignedTo: nob...@puremagic.com > ReportedBy: andrej.mitrov...@gmail.com > > > --- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> > 2010-08-15 10:32:38 PDT --- Code on 2.048: > > import std.stdio; > > interface Timer > { > final void run() { writeln("Timer.run()"); }; > } > > interface Application > { > final void run() { writeln("Application.run()"); }; > } > > class TimedApp : Timer, Application > { > } > > import std.stdio; > > void main() > { > auto app = new TimedApp; > app.Timer.run(); // error, no Timer property > app.Application.run(); // error, no Application property > app.run(); // This would call Timer.run() if the > two calls // above were commented out > } > > The comments state what happens. > > Note that if I changed the order of the TimedApp signature like so: > > class TimedApp : Application, Timer > > then the Application's run() method would be called instead of > Timer's in the app.run() call. >
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.