473,378 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Help with the difference between "Implements" and "Inherits"

What would the difference be between the following two:

public class Foo : IList<string>
{
....
}

public class Foo : List<string>
{
....
}

Thanks,
Tom P.
Jul 24 '08 #1
4 2248
In the first one, Foo would have to manually implement all the members
defined by IList<string>.

In the second one, Foo would already come complete with all the
implementation that exists in List<string>, and you could just add
additional functionality on top of it.

--
Adam Clauss
"Tom P." <pa***********@gmail.comwrote in message
news:01**********************************@w1g2000p rk.googlegroups.com...
What would the difference be between the following two:

public class Foo : IList<string>
{
...
}

public class Foo : List<string>
{
...
}

Thanks,
Tom P.

Jul 24 '08 #2
Tom P. wrote:
What would the difference be between the following two:

public class Foo : IList<string>
{
...
}

public class Foo : List<string>
{
...
}
The first only inherit the interface. The second inherit
only the interface and the implementation.

But I would be careful with the second - it is easy to
become coupled with the internals of List.

Arne
Jul 24 '08 #3
When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance.
When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.
In general Classes can be derived from another class, hence support Implementation inheritance. At the same time Classes can also be derived from one or more interfaces. Hence they support Interface inheritance.
Source: Exforsys
Jul 26 '08 #4
(implementation and interface inheritance)

And your point?

Marc
Jul 26 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Elliott | last post by:
I have a Collection that inherits from CollectionBase and Implements IBindingList which I have bound to a DataGrid. So far everything works fine. However, I am missing one piece to the...
9
by: Max Weebler | last post by:
Hi, I have a datagrid built that has an alternating item style that sets the backcolor and ForeColor of its rows. I have 4 template columns. One of them has a LinkButton embedded in it to...
11
by: Antony | last post by:
I know this sounds stupid but I am going to carry on anyway. I want to create an interface that implements all methods of a form, plus another one or two. But I need to know if there is an...
6
by: John | last post by:
Hi, Maybe someone can explain the use of "Me" to me? The example class CPoint3 uses the Me reference in the output statement: Console.WriteLine("CPoint3 constructor: {0}", Me) The text states:...
4
by: SH | last post by:
I wish to create a program (really a Windows Service) that sits and waits for a client PC to communicate with it, but I can't come up with a good method of doing so. I want to have a service...
0
by: AndyB | last post by:
I'm using xsd.exe to generate a typed-dataset. Then using typed dataset tables (datatables containing two columns--a name and a value) to bind to ASP.NET dropdown list controls (for the dropdown...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
1
by: =?Utf-8?B?QnJldHRWUA==?= | last post by:
I have a child-class that inherits from a base class that implements an Interface. The child class overrides a SUB from the base class that implements a sub from the interface. (The...
3
by: dippykdog | last post by:
I have an IRange interface defined as... Public Interface IRange Property Min() As Object Property Max() As Object End Interface ....and I want to implement that in different kinds of range...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.