Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Please give any real time example. and coding example i cann't understand theroy..... plz plz i studied lot of time i cann't understand...........
Posted
Comments
Sergey Alexandrovich Kryukov 1-Mar-14 23:45pm    
I don't know any real-time platforms for which CLR is implemented, so the question makes no sense.
Yes, I know, it may sound puzzled. But than, think at it: why do you use words that you don't understand at all, such a "real-time"?
—SA
satheeshkumar chinnadurai 2-Mar-14 0:32am    
sorry sir which situation can use interface...
Sergey Alexandrovich Kryukov 2-Mar-14 0:44am    
I'm sure you will get some answers, but they hardly will be useful. This is not how programming is done. The situations where you need interfaces are limitless. You really need to understand what are interfaces and how they work, regardless to purpose. And then you should be able to see how they can be used.
—SA
satheeshkumar chinnadurai 2-Mar-14 0:28am    
Sorry....
Please give any real time example
BillWoodruff 2-Mar-14 1:01am    
You need to say exactly what "real time" is; that could mean several different things.

Agree with Sergey Alexandrovich Kryukov.
But you can read this comments
Real time example of interface[^]
 
Share this answer
 
Quote:
i cann't understand theroy
It's just like your everyday Todo list. Consider you have list of items on your Sunday Tasks which you made on Saturday.
0) Gym
1) Shopping
2) Movie
3) Service center for Bike
4) Pizza

Now, your actions on Sunday like below.
0) Going to Service center for Bike repair minor things - 07:00 AM
1) Going to Gym by walk as no bike to ride              - 07:30 AM
And reach home after riding bike from Service center.
2) Going to movie with friends                          - 11:00 AM
3) Shopping with GF                                     - 04:00 PM
4) Night dinner @ Pizza mall                            - 08:00 PM

Same way, you could define things in Interface & later implement things in class using Interface. You could find more than bunch of articles in Codeproject on this topic.
 
Share this answer
 
Comments
satheeshkumar chinnadurai 3-Mar-14 7:28am    
thanks
Well, in client-server architecture, an Interface is an contract (i.e an Agreement) between client and server which is implemented on server side and tells the client that what it contains. The examples can be RMI.

One interface can be implemented by more than one classes, that's why you can have multiple kind of instance of that interface.

For example, in .NET object is base class of all of the other classes, even user-defined as well.
This object class implement the interface that has these 4 methods like Equals(), ToString(), GetType() and GetHashCode(). You can find more info here[^].

Let's talk about ToString(). You may find this method each and every damn objects in your application. For example, you can get the String format of int, float, double and/or user defined objects. But the question is how to distinguish which ToString() works for int, which for double and which for float?

So the answer is these wrapper i.e Int, Double, Float etc class has the implement of the object interface and each may have the different implement for ToString().

In this kind of situation you need an interface. Let's say in you application, 5 classes has almost same methods but works differently so you can create one interface, implement by these 5 classes and can use it.

Some examples,
http://msdn.microsoft.com/en-us/library/87d83y5b.aspx[^]

[^]
http://www.onlinebuff.com/article_implementing-interface-in-c-with-an-example_18.html[^]
http://www.c-sharpcorner.com/UploadFile/sekarbalag/interface-best-example-in-csharp/[^]
http://www.c-sharpcorner.com/UploadFile/sekarbalag/interface-best-example-in-csharp/[^]

Hope this would help you.

-KR
 
Share this answer
 

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