Questions related to teaching about interfaces in the object oriented paradigm. A class implementing an interface is considered to have "signed a contract", which ensures that has methods described in the interface. DO NOT use this tag to ask about interfaces in general, OR about user interface.
In the Object Oriented Paradigm, an interface (sometimes called Protocol) is a means for unrelated objects to communicate with one another. An interface defines method signatures, and those methods must be be present in any object which implements the interface.
Interfaces can be thought of a description of:
- Methods that are used by the object.
- Arguments that those methods receive.
- The return type of those methods.
- Invariants that are not changed by those methods.
More information about interfaces (specifically in
java, but also contains details which are not language-specific) can be found here