On Wednesday, 6 December 2017 at 23:56:33 UTC, Q. Schroll wrote:
What is D's position on that? The interface spec [2] does not
say anything about that case.
It seems it's allowed, but the caller is required to disambiguate.
import std.stdio;
interface I { void f(); }
interface J { int f(); }
class A : I, J
{
void f() { writeln("void f()"); }
int f() { writeln("int f()"); return 0; }
}
void main()
{
A a = new A();
// Error: A.f called with argument types () matches both:
A.f() and A.f()
// Yeah, that error message could be better.
//a.f();
(cast(I)a).f(); // prints "void f()"
(cast(J)a).f(); // prints "int f()"
}
https://run.dlang.io/is/lZSblC
Mike