Abstract classes, Interfaces, and Patterns
- slide 13 : 37
Examples of Interfaces
Two or more unrelated classes can be used together if they implement the same interface
The interface IGameObject.
The class Die which implements IGameObject.
The class Card which implements IGameObject.
A sample Client program of Die and Card.
Output from the sample Client program of Die and Card.
In the example above, the GameObject could as well have been implemented as an abstract superclass
An abstract GameObject class