Answer the question
In order to leave comments, you need to log in
When should you use interfaces?
I don't understand the situation at all when they should be used.
Answer the question
In order to leave comments, you need to log in
In those situations where you can have several classes with the same set of methods, but with different implementations.
For example, you can invent an ITextWriter interface that will have a WriteLine method.
You can come up with several implementations of such an interface - one will write to the console, and the other can add lines to some kind of array, and the third one will generally be sent to some kind of web service.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question