C++20 sections · 1024 units
Open in CourseQuiz: Inheritance Design
Knowledge check
Check Your Understanding
When should you prefer composition over inheritance?
- A.When you need polymorphic behavior
- B.When both classes need the same data members
- C.Never - inheritance is always better
- D.When the relationship is 'has-a' rather than 'is-a'