Tying It All Together: An Example
Let’s work on a simple example that will tie the concepts of inheritance, interfaces, composition, associations, and aggregations together into a single, short system diagram.
Consider the example used in Chapter 8, with one addition: We will add an Owner
class that will take the dog out for walks.
Recall that the Dog
class inherits directly from the Mammal
class. The solid arrow represents this relationship between the Dog
class and the Mammal
class in Figure 9.9. The Nameable
class is an interface that Dog
implements, which is represented by the dashed arrow from the Dog
class to the Nameable
interface.
Get The Object-Oriented Thought Process, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.