如果一个类从两个单独的接口实现一个接口,它的行为是否与它只实现一次一样?
例子:
public interface IAnimal { /* ... */ }
public interface IFullAnimal : IAnimal { /* ... */ }
public interface IBear : IAnimal { /* ... */ }
public interface IFullBear : IBear, IFullAnimal { /* ... */ }
// and implementing IFullBear:
public class FullBear : IFullBear { /* ... */ }
上面,从两者和通过FullBear
实现。这是否会引入有关 IAnimal 实现的任何奇怪行为,因为两者都没有提供有关实现的任何信息(因为语言不允许这样做)。IAnimal
IFullAnimal
IBear
IFullBear
IFullAnimal
IBear
IAnimal