- For inheritance, you can use a relationship such as a Dog “is-a” Pet.
- This relationship can help clarify situations in which inheritance is not valid.
- For example, you would not say a Tail “is-a” Dog, thus these two classes should not be in an inheritance relationship.
- This relationship can help clarify situations in which inheritance is not valid.
- For composition, you can use a relationship such as a Dog “has-a” Tail.
- This relationship can help clarify situations in which composition is not valid.
- For instance, you would not say a Dog “has-a” Pet, thus these two classes should not be in a composition relationship.
- This relationship can help clarify situations in which composition is not valid.