Generally speaking, composition is favored over inheritance because it provides many advantages. In this case, why inheritance is provided as one of the main concepts of OOP.
My question is when to support inheritance Better than composing?
Recommended reading: Gang Of Four discusses Type, Interface, OOP, etc. before starting to discuss the mode.
Also take a look:
Composition vs. Inheritance: How to Choose?
This question seems to be repetitive, but it is not the case. I searched with Google and the bus cannot get the conceptual clarity. There are many examples of animals, cars. But , I want to understand the basic logic.
Generally speaking, composition is favored over inheritance because it provides many advantages. In this case, why inheritance is provided as one of the main concepts of OOP.
My The question is when is support for inheritance better than composition?
Rather than change, maintainability, etc., I think the core concepts are important. In certain situations, relationships seem to be better than having relationships?
Recommended reading: Gang Of Four discusses Type, Interface, OOP, etc. before starting to discuss the mode.
Also take a look:
Composition vs. Inheritance: How to Choose?