Minimum requirements for IFoo
IFoo
should inherit IWidget
and IThingy
.
It also needs to include all public members of Foo
and WidgetBase
.
public interface IFoo : IWidget, IThingy
{
// public member of Foo and WidgetBase...
}
Potential refactoring 1:
It would probably be better to define an interface for WidgetBase
like this:
public interface IWidgetBase : IThingy
{
// public members of WidgetBase...
}
then IFoo
could just inherit that:
public interface IFoo : IWidget, IWidgetBase
{
// public member of Foo.
}
Potential refactoring 2:
The same could apply to BusonessObject
: define an interface for it, and have IWidgetBase
inherit that.
General principal:
Your interfaces should specify the behaviours of your objects, and should use inheritance where behaviours are naturally extended.