Advantages and Disadvantages of Inheritance in Java
Inheritance is one of the pillars of the Java programming language. Learning OOP (Object Oriented Programming) without knowing and understanding the concept of Inheritance, its pros and cons are incomplete. Inheritance is a process in which a class acquires all the data members and its parent class methods. The basic idea behind it is that you create new classes based on the existing classes with additional data and methods. Example:
1 2 3 4 5 6 7 8 9 |
class SuperHello { ..... ..... } class Sub extends SuperHello { ..... ..... } |
In the above example, there are two classes SuperHello
Read more