界面我很困惑與該場景的抽象類和接口具有相同簽名的方法。在派生類中有多少個定義?該呼叫將如何解決?tclass擴展一個抽象類,實現了用相同的簽名方法
public abstract class AbClass
{
public abstract void printMyName();
}
internal interface Iinterface
{
void printMyName();
}
public class MainClass : AbClass, Iinterface
{
//how this methods will be implemented here???
}
您必須使用顯式方法重寫。最多隻有兩個定義。例如:第一種方法。 'AbClass.printMyName(){console.writeln(「我是AbClass」)};'。 第二種方法:'Iinterface.printMyName(){console.writeln(「I am Iinterface」)};' –