假设我有三个接口:
public interface I1
{
void XYZ();
}
public interface I2
{
void XYZ();
}
public interface I3
{
void XYZ();
}
继承这三个接口之一的类:
class ABC: I1,I2, I3
{
// method definitions
}
问题:
If I implement like this:
class ABC: I1,I2, I3 {
public void XYZ() { MessageBox.Show("WOW"); }
}
How can I implement the method of all the three interfaces and CALL THEM? Something Like this:
ABC abc = new ABC(); abc.XYZ(); // for I1 ? abc.XYZ(); // for I2 ? abc.XYZ(); // for I3 ?
我知道可以使用显式实现来完成,但我无法调用它们。:(
ICollection<T>
等操作时,您希望将非泛型的IEnumerable
实现“隐藏”在正常类定义之外。 - Dean Harding