c#中继承和接口的问题.
//定义两个接口,有相同的方法
interface ISampleInterface
{
void SampleMethod();
}
interface ISampleInterface2
{
void SampleMethod();
}
//定义一个类实现接口,显式实现接口.
class ImplementationClass : ISampleInterface,ISampleInterface2
{
void ISampleInterface.SampleMethod()
{
System.Windows.Forms.MessageBox.Show("test");
}
void ISampleInterface2.SampleMethod()
{
System.Windows.Forms.MessageBox.Show("test2");
}
}
问题:就是void ISampleInterface.SampleMethod()不能加如public,virtual之类的关键字了,不知道是什么原因,各位高手解答下..