When did people favor composition over inheritance?(sicpers.info)
sicpers.info
When did people favor composition over inheritance?
https://www.sicpers.info/2025/11/when-did-people-favor-composition-over-inheritance/
3 コメント
The summary of the post says that lambdas/procedures/etc. are another type outside of composition and inheritance. I’ve always thought of lambdas as composition though. You’re assigning a function just as you would any other data, right?
Using inheritance becomes painful in languages like C++ as soon as diamond-like hierarchies are involved.
Composition needs more memory per class and object, but is faster at runtime.