Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

c# - 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 derives from class A".

However, if I instead have:

  class B : ISomeInterface   {}

it's wrong to say "B inherits ISomeInterface" -- the proper term is to say "B implements ISomeInterface".

But, say I have

  interface ISomeInterface : ISomeOtherInterface   {}

Now, it's still wrong to say "inherits", but it's now just as wrong to say "implements" since ISomeInterface doesn't implement anything.

So, what do you call that relationship?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I personally say "extends" and I thought the C# spec uses that word as well somewhere (I can't find it now, unfortunately) - but I remember Eric Lippert saying he wasn't keen on it, and wanted to change it for 4.0.

I think it's good, because it shows that you're extending the contract specified by the original interface.

EDIT: Having looked at the 3.0 spec...

The spec sort of side-steps the issue in section 13.2. It talks about the members being inherited from the base interfaces. It talks about one class extending another, but not interfaces

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

An interface can inherit from zero or more interface types

So that's probably the best term to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...