Inheritance
What is Inheritance?
- Its a way of deriving the properties of new class from already existing class.
- The existing class is called super class or base class or parent class
- The new class is called subclass or derived class or child class.
- Inheritance allows subclasses to inherit the variables and methods of their super class
Note
- Object class is the super class for all predefined and user define classes in java
Types of Inheritance
Single Inheritance:
- Creating sub classes from single super class is called single inheritance
Multi level Inheritance
- A class is derived from another derived class is called Multilevel inheritance
Multiple Inheritance
- A class is derived from multiple super classes is called Multiple inheritance
Advantage
- Application development time is very less.
- Repetition of the code is reducing, so we can get less memory.
Thanks for your time.
Nireekshan