Credit to @CodeCaster for his/her great comments that prompted this answer.
The proposal states:
Note that a class does not inherit members from its interfaces; that
is not changed by this feature:
Thus, it seems reasonable (although impossible to confirm with 100% certainty until it is shipped) that:
public interface A { int Foo() => return 1; }
public interface B { int Foo() => return 2; }
public class C : A, B { }
will work fine.
Just as the proposal shows:
new C().M(); // error: class 'C' does not contain a member 'M'
then we can assume, your version:
new C().Foo();
will also not compile.
The proposal shows:
IA i = new C();
i.M();
as valid, which is equivalent to your:
A i = new C();
i.Foo();
Since i
is declared as type A
there is no reason to assume the same would not work if A
was changed to B
- there are no collisions to speak of.
The entire point of this feature is to allow interfaces to be extended in a safe way (see this video). If this only worked if you implemented one interface, that seems contrary to the objective of the feature. And given the feature appears to be implemented in a way roughly akin to explicit interface implementation (which is why we can't invoke C.Foo()
directly), I think we can reasonably assume that it will most likely allow for multiple interface implementation.