Generally:
You can see the interface as a contract or agreement between the two parties. Therefore, they can evolve independently until the interface changes.
The caller knows what behavior is available, and the executing party knows what to implement.
There are many advantages to using interfaces. One of them is that itβs easy to switch between implementations. Another is that classes can have different (inter) faces without using multiple inheritance.
Toon krijthe
source share