hi i have an assignment regarding this topic, can anybody help me please? due date is 11 july.
Suppose you are working as a software developer in a company. You have been given a task to develop a software system design for some real world scenario. One of the basic activities of any software system design is to establish relationships between classes. Suppose at the stage of creating relationships for some classes, you have to choose either inheritance or composition as these are two fundamental ways to relate classes by achieving feature of code re-usability. Being a developer, for what reasons, would you prefer one technique to the other keeping in mind the reusability factor? Support your answer with solid reasons
use inheritance only when you want to extend the functionality of the base class.
classical example within a GUI would be event handling (such as button click)
composition offers more flexibilty/interoptability
An example for this are the STL container. There's usually no need to extend them. They can be easily exchanged