|
-
Nov 5th, 2005, 05:27 AM
#1
Thread Starter
Addicted Member
Interface in OOP
What is the advantages of using Interface in OOP? Please give an example using Interface to clarify that using Interface is better than one without interface.
-
Nov 6th, 2005, 09:47 AM
#2
Re: Interface in OOP
Implementing an interface offers advantages in certain circumstances. One advantage is that it allows you to take a number of different types, that may be quite different in some regards, and treat them in the same way. An example would be the DataGrid.DataSource property, which will accept any component that implements either the IList or IListSource interface. This means that you can create a class with whatever functionality you like but as long as it implements one of those interfaces you can bind it to a DataGrid.
-
Nov 6th, 2005, 10:43 PM
#3
Re: Interface in OOP
An interface provides a common (if perhaps partial) specifiction for a class. You can rely on the fact that all classes that implement that interface will have the same methods as defined in the interface, even if they behave differently.
Another example is plugins, if you design an common interface for an application plugin you can specify plugins using that interface, regardless of what the plugin actually does.
-
Nov 8th, 2005, 01:15 AM
#4
Thread Starter
Addicted Member
Re: Interface in OOP
I want to ge more ideas about Interface. Need help.
-
Nov 8th, 2005, 01:20 AM
#5
-
Nov 8th, 2005, 01:31 AM
#6
Re: Interface in OOP
Read this and follow the relevant links at the bottom, which really gives you all you need to know about interfaces as they relate to VB.NET: http://msdn.microsoft.com/library/de...BSpec6_7_1.asp
Things are pretty much the same in C#.
-
Nov 11th, 2005, 11:23 AM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|