InterviewSolution
| 1. |
Why Inheritance Is Used By Java Programmers? |
|
Answer» Inheritance is used for code reuse and leveraging POLYMORPHISM by CREATING a type HIERARCHY. It's better to USE Inheritance for type declaration but for code reuse composition is a better option because it's more flexible. See this article for LEARNING more about why Composition is better than Inheritance. Inheritance is used for code reuse and leveraging Polymorphism by creating a type hierarchy. It's better to use Inheritance for type declaration but for code reuse composition is a better option because it's more flexible. See this article for learning more about why Composition is better than Inheritance. |
|