In this recipe, you will learn the last of the OOP concepts, called interface, and further practice the usage of aggregation and polymorphism as well as inner classes and inheritance.
Coding to an interface
Getting ready
An interface defines the signatures of the methods one can expect to see in the class that implements the interface. It is the public face of the functionality that's accessible to a client and is thus often called an Application Program Interface (API). It supports polymorphism and aggregation, and facilitates a more flexible and extensible design.
An interface is implicitly abstract, which means it cannot be instantiated. No object can be created based on an interface only, without implementing it...