给定以下接口:
interface IFoo
{
void Foo();
}
interface IBar : IFoo
{
void Bar();
}
怎样最好地表明一个类实现了IBar
接口?
方法A:
class Implementation : IBar { ... }
这个看起来更简单清晰,但它并没有说明
Implementation
实现了 IFoo
。
方法 B:
class Implementation : IBar, IFoo { ... }
这似乎是最具信息量的,但额外的信息真的必要吗?