Would someone please explain to me what the below paragraph means? This is a snippet from “Design Patterns: Elements of Reusable OO software”
Part of an object’s interface may be characterized by one type, and other parts by other types. Two objects of the same type need only share parts of their interfaces. Interfaces can contain other interfaces as subsets. – Design Patterns – Elements of Reusable OO software, pg 13
Perhaps what the author is saying is that an object can implement more than one interface. For instance, a “RaceCar” class might implement the “Drivable” interface while also implementing the “PotentiallyDangerous” interface.
In this example the RaceCar class might implement the “useNitrous()” method as declared by the “PotentiallyDangerous” interface and also implement the “startIgnition()” method declared by the “Drivable” interface.
Sorry, nothing against RaceCar enthusiasts, but it’s the best car example I could get someone to edit for me.
EDIT drachenstern: thought you might appreciate the humorous edit, feel free to revert.