1.Inheritance is when one class acquires the properties and behaviors (fields and methods) of another class.
2.It helps you reuse code, avoid duplication, and organize your program logically.
👉 In simple words:
3.A child class (subclass) can inherit from a parent class (superclass).
4.A class which is inherits from another class. A child class/subclass behave like a parent class or base class.
4.The class that inherits from another class. It can also be called a derived class or extended class.
- extends keyword: Used to establish the inheritance relationship. A subclass uses extends to inherit from a superclass.
Top comments (0)