What is the benefit of Composition over Inheritance?
Answer / Vinay Vishal
Composition offers better modularity, flexibility, and extensibility because it allows creating objects with specific behavior without inheriting unwanted properties from other classes. With inheritance, you are forced to use methods that may not be useful or appropriate for your specific needs.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is operator overloading and polymorphism?
1 Answers ITC Indian Tobacco Company,
Can we use static method definitions in interfaces?
How many methods do u implement if implement the serializable interface?
What is static and dynamic Binding?
What is a pure virtual function?
How to differentiate between a CreateObject() and GetObject() ?
Can encapsulation be called as a security device?
A class inherits from 2 interfaces and both the interfaces have the same method name as shown below. How should the class implement the drive method for both car and bus interface?
What's the benefit of using inheritance?
Explain about inheritance hierarchies?
Can an interface inherit from another interface?
What is the benefit of using inheritance?