Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is interface in C#?
Please tell me a real time example?
Posted
Updated 17-Jun-10 18:15pm
v2

saurabhajay wrote:
what is interface in c#?pls tell me a real time example?


interface IClock
{
  DateTime now();
}

:-D


Seriously, see the documentation [^].
:)
 
Share this answer
 
Another homework question? Google is your friend: use it.
 
Share this answer
 
Comments
[no name] 20-Jun-10 11:34am    
Reason for my vote of 1
banal answer
R. Giskard Reventlov 21-Jun-10 3:52am    
Don't notice you giving an answer - if this is the best you can come up with...
In real world example, Interface is just like a mobile phone or universal remote control. You have one remote control(interface) for all your TV sets :laugh:(sub classes)
So using one interface you use many sub-classes. :omg:
 
Share this answer
 
Consider that if you actually got off your backside, and bought a book, or read some tutorials, you wouldn't be asking us such basic questions. Consider also that when your questions are so basic, we don't know how to answer, because none of the evidence makes us feel you're capable of comprehending the reply.
 
Share this answer
 
You might want to pick up a beginner C# book and go through it for the definition.

An interface is a contract that any class implementing that interface must follow.
 
Share this answer
 
v2
See this:Interface in C#
 
Share this answer
 
Comments
Dylan Morley 27-Jan-12 7:22am    
No need to add an answer to a question that is almost 2 years old & has multiple solutions already

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