interface IA : interface IB { ... }
so IB is the parent interface of IA, IA is the _ of IB. What should be put in the blank? sub-interface?
interface IA : interface IB { ... }
so IB is the parent interface of IA, IA is the _ of IB. What should be put in the blank? sub-interface?
There's no inheritance relationship between .NET interfaces. This is evident if you use Reflection - typeof(IB).BaseType
will be null
, not IB
.
Personally, I prefer to think of interfaces as contracts. In this case, "inheritance" of interfaces is really just strengthening the contract - so I'd say "contract IB
implies IA
". Eric Lippert seems to share this point of view:
He regards extension as being about reuse of implementation, whereas specifying a "base" interface is about saying that "any object fulfilling this contract must also fulfill this other interface".
Alternatively, "IA
extends IB
" sounds understandable while being technically correct (if we're talking about extending a contract), though perhaps somewhat misleading, as we're tightening the contract in "extended" interface, not relaxing it.
Yet another way is to go with what C# language specification uses. That one has a section on the topic titled "Base interfaces", and starts with the following sentence:
An interface can inherit from zero or more interface types, which are called the explicit base interfaces of the interface.
So there you have it. Though it should be noted that this is for C# 3.0; past versions of the spec actually used "extends" rather than "inherits" to describe the same thing, so there is still some possibility of confusion.
It is said that IA is the subinterface of IB, and IA extends IB.
So, IB is the superinterface of IA.
All classes based on these interfaces implements them.