34 ms·
First, one needs to distinguish between interface inheritance and implementation (class) inheritance. When one talks about composition vs inheritance, one usual
by perfunctory 8y ago
First, one needs to distinguish between interface inheritance and implementation (class) inheritance. When one talks about composition vs inheritance, one usually means implementation inheritance.
- Inheritance is static. Composition can be dynamic.
- Composition avoids "fragile base class" problem.
- Modifying base class requires access to source code. Composition does not.