When you implement two interfaces with the same method, how do you know which one is called?

后端 未结 8 1459
再見小時候
再見小時候 2021-01-13 05:18

If you have TheMethod() in interfaces I1 and I2, and the following class

class TheClass : I1, I2
{
    void TheMethod()
}

If s

8条回答
  •  自闭症患者
    2021-01-13 05:59

    That is irrelevant. Casting to any of the interfaces will result in the method being called, but since an interface cannot contain code you cannot inherit behavior from it.

提交回复
热议问题