From a theoretical point of view, what are interfaces good for?
I know that they allow us to implement multiple inheritance; but are they widely used for something else?
From a theoretical point of view, what are interfaces good for?
I know that they allow us to implement multiple inheritance; but are they widely used for something else?
Interfaces help us to define abstraction for what some object is and how it should behave, while classes help us to implement that abstraction.
An interface is a specifies what the object can do.
An abstract class specifies what an object is.
Interfaces allow you to define or classify similar types of behaviour across classes that are otherwise completely unrelated. You can do something similar with inheritance, but the classes are not loosely coupled.