0

What are interfaces main purposes and what features do they offer to give us a solid reason to use them?

Edited by pritaeas: Closed duplicate.

3
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by pritaeas
0

Greetings, here's a couple of examples stating when interfaces should be used by Microsoft:

Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality.

  • Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces.

  • Interfaces are better in situations in which you do not have to inherit implementation from a base class.

  • Interfaces are useful when you cannot use class inheritance. For example, structures cannot inherit from classes, but they can implement interfaces.

In general, interfaces are used in order to create a semantics-only structure of a class and have it implemented differently based on the scenario you have.

Hope I helped,
Alex

Edited by Alexpap: Fixed List