原文地址:https://www.cnblogs.com/huanghezhao/p/11257455.html
问题:如果有两个接口,他们恰好声明了同名方法,而这两个方法的参数相同,但返回类型不同。如何写一个类,同时实现这两个接口?
答:没法实现。这篇文章[1]已经给出证明了,就不再累述。
C#就很好地解决了这个问题。C#允许一个类在实现接口时,显式地标注实现的是哪个接口的哪个方法[2]。
参考资料
原文地址:https://www.cnblogs.com/huanghezhao/p/11257455.html
问题:如果有两个接口,他们恰好声明了同名方法,而这两个方法的参数相同,但返回类型不同。如何写一个类,同时实现这两个接口?
答:没法实现。这篇文章[1]已经给出证明了,就不再累述。
C#就很好地解决了这个问题。C#允许一个类在实现接口时,显式地标注实现的是哪个接口的哪个方法[2]。
参考资料