【发布时间】:2014-12-19 12:09:19
【问题描述】:
下面是我的代码:
public interface I1
{
void method1();
}
public interface I2
{
void method1();
}
class MyClass
{
static void Main(string[] args)
{
One one = new One();
}
}
public class One :I1,I2
{
void I1.method1()
{
Console.WriteLine("This is method1 from Interface 1");
}
void I2.method1()
{
Console.WriteLine("This is method1 from Interface 2");
}
}
我有以下问题:
- 我无法在类 One 中将方法声明为 Public,因为这些是接口方法。
- 我无法从 Main 函数中的 MyClass 实例调用这些接口方法实现。
【问题讨论】: