Newbie question: Can an Interface actually IMPLEMENT another Interface?

M

mark_vogt

Greetings all,

As I dig into my new copy of Visual Studio 2005 Pro and VB.NET, I've
watched a number of online videos, and read a number of postings right
here in this news group that make the statement

1. "IList and IDictionary IMPLEMENT ICollection"

Being a relative novice to full-fledged OOP, I struggle with this
statement, as my understanding of an Interface is:

2. "a contract that defines property and method signatures for a
class, but WITHOUT implementing these properties and methods".

How do I reconcile these 2 statements?

In VB.NET I can indeed say "IList and IDictionary DERIVE from
ICollection - via Interface inheritance that I understand is possible
now. But I just don't see how one Interface is supposed to IMPLEMENT
another interface when the very meaning of "Interface" is (more or
less) "specification WITHOUT implementation".

It's my current (limited) understanding that class and/or structures
can implement Interfaces, but Interfaces themselves canNOT implement
other Interfaces.

Is this just sloppy choice of words by some well-known trainers and/or
posters, or is there something I'm still not getting about OOP in
VB.NET?

TIA,
- MV
 
G

Guest

1. "IList and IDictionary IMPLEMENT ICollection"

Being a relative novice to full-fledged OOP, I struggle with this
statement, as my understanding of an Interface is:

2. "a contract that defines property and method signatures for a
class, but WITHOUT implementing these properties and methods".

How do I reconcile these 2 statements?

Interfaces can inherit from another interface. If you checked MSDN,
you'll see that:

Public Interface IList
Inherits ICollection, IEnumerable

Thus IList must implement ICollection, IEnumerable, and anything else
defined in IList.
In VB.NET I can indeed say "IList and IDictionary DERIVE from
ICollection - via Interface inheritance that I understand is possible
now. But I just don't see how one Interface is supposed to IMPLEMENT
another interface when the very meaning of "Interface" is (more or
less) "specification WITHOUT implementation".

Where did you get the worlding IList and IDictionary Implement
ICollection? As MSDN writes: "IList is a descendant of the ICollection
interface..."

http://msdn2.microsoft.com/en-us/library/system.collections.ilist.aspx
It's my current (limited) understanding that class and/or structures
can implement Interfaces, but Interfaces themselves canNOT implement
other Interfaces.

Interfaces cannot implement interfaces. They can only inherit from other
interfaces.
Is this just sloppy choice of words by some well-known trainers and/or
posters, or is there something I'm still not getting about OOP in
VB.NET?

Yes probably just a slip of the tongue :)
 
R

RobinS

I think you are confused about something that I originally found confusing.
Let me see if this better defines your question.

You've read about Interfaces, and know that if you define one, then when
you implement it, you have to write code for those procedures, right?

But then you run across something like the IBindingList interface that you
can inherit, and you don't have to write any code to use it, and that
doesn't make sense.

Is this what you mean?

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top