Question: what is the difference between inheritance and composition in c++?
Answer: Composition is usually used for wrapping classes and to express relationships between classes that contain one another. Inheritance is used for polymorphism, where you have a base class and you want to extend or change its functionality. ... It means deriving properties, characteristics and behaviors from a parent class.