So my question is, why to use interfaces or abstract classes? Why are they useful, and for what?
Where can i use them intelligently?
See Question&Answers more detail:osSo my question is, why to use interfaces or abstract classes? Why are they useful, and for what?
Where can i use them intelligently?
See Question&Answers more detail:osInterfaces allow you to express what a type does without worrying about how it is done. Implementation can be changed at will without impacting clients.
Abstract classes are like interfaces except they allow you to provide sensible default behavior for methods where it exists.
Use and examples depend on the language. If you know Java, you can find examples of both interfaces and abstract classes throughout the API. The java.util collections have plenty of both.