Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please guide me about interface, when to use interface and why we use interface?

Thanks
Posted

The first hit by Google is here[^] on CodeProject.
 
Share this answer
 
Comments
attiq_khan 4-Jul-11 5:25am    
thanks alot
Sergey Alexandrovich Kryukov 4-Jul-11 16:53pm    
Reasonable, my 5. Please see my answer, too.
--SA
Google is your friend! Start here Abstract Class versus Interface[^]

Cheers!
 
Share this answer
 
Comments
attiq_khan 4-Jul-11 5:25am    
thanks alot
Google can help - your subject line used as a search term will take you to MSDN[^] and the start of a series of short articles on when and why to use interfaces.

Please, try to use google first - it can save you a lot of time...
 
Share this answer
 
Comments
attiq_khan 4-Jul-11 5:24am    
thanks alot
OriginalGriff 4-Jul-11 5:32am    
You're welcome!
Sergey Alexandrovich Kryukov 4-Jul-11 16:53pm    
Reasonable, my 5.
Please see my answer, too.
You got some reasonable answers. Please also see the useful discussion here:
When we use abstract and when we use interface...?[^],
Difference between abstract class and interface if they have same no of methods and var[^].

Please check out not just my answers, but all other posts. Some are interesting and useful.

—SA
 
Share this answer
 
v2
Comments
Richard MacCutchan 5-Jul-11 5:37am    
A 5 for your answer which points the way to lots of good information. I must read the article in the link I posted to see if it really explains the issues, as I see so many repeats of this question.
Sergey Alexandrovich Kryukov 5-Jul-11 5:45am    
Thank you, Richard.
--SA
hi,

use interface are
1. Apply Common Standard Coding
2. Casting

Casting means we have an object that contain all the function and variable in it but we want only one function in that obejct then we create an interface and cast the object. in the case of remoting we don't know the type of object so we cast that object using our interface
 
Share this answer
 
Interfaces are used when you want to establish some contract. That is the common use case for the interfaces.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Jul-11 16:49pm    
OK, pretty much correct, but why not an abstract class then? Also a contract?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900