Design Patterns · Junior · Question 65 of 75
What's the difference between "is-a" and "has-a" relationships?
- ✓Correct answer: "Is-a" suggests inheritance (a Dog is an Animal); "has-a" suggests composition (a Car has an Engine)
- 2They're the same
- 3"Has-a" always means a database relation
Explanation
If the relationship is really "has-a" or "uses-a", inheritance creates unnecessary coupling.