Computer Applications
Why do you need to use inheritance? Give two reasons.
Encapsulation & Inheritance in Java
1 Like
Answer
We need to use inheritance for the following reasons:
- Inheritance divides a program into useful and reusable set of classes.
- Changes made in the original class are reflected in all the inherited classes.
Answered By
2 Likes
Related Questions
What does the inheritance mechanism allow one class to acquire from another?
How is inheritance transitive? Explain.
Explain various types of inheritance.
Declare a public class CoolClass.
- Write the header for a public member method CoolMethodA.
- Write the header for an integer member method CoolMethodB that should be accessible to the classes in the package but not to derived classes.
- Write the header for an integer member method CoolMethodC that should be accessible only to other methods of the class.
- Write the header for a character member method CoolMethodD that should be accessible to the classes in the package and any derived classes.