ref2401 wrote:
> Does D provide a way for explicit interface implementation?
> [C#] https://msdn.microsoft.com/en-us/library/ms173157.aspx
Not exactly, but you may try something like this:
interface A
{
void foo();
}
interface B
{
void foo();
}
class C : A
{
class Nested : B
{
void foo()
{
this.outer.fooB();
}
}
Nested nested;
alias nested this;
this()
{
nested = this.new Nested;
}
void foo()
{
import std.stdio : writeln;
writeln("A's foo");
}
void fooB()
{
import std.stdio : writeln;
writeln("B's foo");
}
}
void main()
{
C c = new C;
A a = c;
B b = c;
a.foo();
b.foo();
}
Prints:
A's foo
B's foo