QuickDevGuide

Home › OOPs

Inheritance — OOPs

Inheritance allows one class (child/subclass) to acquire properties and methods of another class (parent/superclass). It promotes code reusability and uses the extends keyword. The parent class is called Superclass and the child class is called Subclass. This creates an "is-a" relationship: a Dog IS-A Animal. A Manager IS-A Employee. The child inherits all parent behaviors but can override them to provide specialized implementations. Types of Inheritance a) Single Inheritance — One child class inherits from one parent class (e.g., Manager extends Employee). b) Multilevel Inheritance — A chain of inheritance (e.g., Person → Employee → Manager). c) Hierarchical Inheritance — Multiple child classes inherit from one parent (e.g., Car and Bike both extend Vehicle). d) Multiple Inheritance — A…

Key Takeaways