What do you call it when one interface "inherits" from another?

If I have class B: A {}

I say that "class B inherited class A" or "class B comes from class A".

However, if I instead:

class B : ISomeInterface {} 

It is wrong to say that "B inherits ISomeInterface" - the correct word is "B implements ISomeInterface."

But let's say I have

  interface ISomeInterface : ISomeOtherInterface {} 

Now it’s still wrong to say “inherit”, but now it’s also wrong to say “implements”, since ISomeInterface does not implement anything.

So what do you call it?

+43
c # oop interface
Apr 30 '09 at 14:33
source share
6 answers

I personally say "extends" and I thought that C # spec also uses this word (I can’t find it now, unfortunately), but I remember Eric Lipper saying that he was not interested in it and wanted to change it on 4.0.

I think this is good, because it shows that you are extending the contract specified by the source interface.

EDIT: looking at specification 3.0 ...

The specific type of side effects in section 13.2. It states that members are inherited from the underlying interfaces. He says that one class extends another, but not interfaces

EDIT: In the C # 5 specification, section 13.1.4, it uses inherits:

An interface can inherit from zero or more types of interfaces

So probably the best term to use.

+57
Apr 30 '09 at 14:34
source share

I call it "extends".

+7
Apr 30 '09 at 14:34
source share

I usually call it overengineering.

+7
Feb 04 2018-10-12T00
source share

As an authoritative source , and if you need a useful quote, I came across information on MSDN that describes " interface inheritance " with a practical example of an interface inheritance structure for ComboBox, Control, Listbox and TextBox:

And with the reference to an explicit base interface

An interface can inherit from zero or more interfaces , which is called the explicit underlying interface of the interface.

Example:

 interface IControl { void Paint(); } interface ITextBox: IControl { void SetText(string text); } interface IListBox: IControl { void SetItems(string[] items); } interface IComboBox: ITextBox, IListBox {} 

Source:

http://msdn.microsoft.com/en-us/library/aa664578%28VS.71%29.aspx

+6
Apr 09 '14 at 7:35
source share

Why would it be wrong to say that an interface "inherits" or "comes from" InterfaceA? "Implementations" will be incorrect because InterfaceB does not provide an implementation. Semantically, the output of interfaces is very similar to getting classes. C ++, for example, does not distinguish between interfaces and classes at all.

+2
Apr 30 '09 at 14:48
source share

you have the wrong definition.

B: A means that B inherits from A.

when we say that "B implements an interface", which usually means that InterfaceA does not have a definition function - these are just prototypes (or PURE in C ++). However, in C ++ and most OOPL, inheritance and implementation have the same syntax.

So, InterfaceB: InterfaceA still means that "interfaceB inherits the interface."

+1
Apr 30 '09 at 14:36
source share



All Articles