Composition is more flexible than inheritance. You can put many objects into another object with composition, while with inheritance you only subclass. Note that another option are the sum types, also called ADT or objects variants. They can have advantages for performance, as you can have value types in a seq then, also mentioned in my book.
- Inheritance vs composition mantielero
- Re: Inheritance vs composition Stefan_Salewski
- Re: Inheritance vs composition mantielero
- Re: Inheritance vs composition adnan
- Re: Inheritance vs composition cantanima
