What Interfaces Are
Interfaces basically define a blueprint for a class or a
struct. The programmed definition of an interface looks very similar to a
class, but nothing is implemented. Interfaces define the properties, methods,
events, and indexers, but the interface does not define the implementation of
any of these. It just declares their existence. Interfaces will not actually
define any functionality. They just define ways in which interactions with a
class takes place.
What Interfaces Are Not
Interfaces should not be confused with inheritance.
They are two very different things. Inheritance will define a lot of the
implementation and is used for code reuse. Interfaces are merely a definition
for how communication with the implementing classes must take place. It is like
a written contract. A class "signing" the contract will agree to
perform certain specified actions in any way it wishes, but it must perform the
specified actions.
When to Use Interfaces
Interfaces allow us to create nice layouts for what a class
is going to implement. Because of the guarantee the interface gives us, when
many components use the same interface it allows us to easily interchange one
component for another which is using the same interface. Dynamic programs begin
to form easily from this.