Inheritance is the most important feature of Object-Oriented Programming.

Inheritance in Object-oriented programming is a mechanism to make the code reusable by defining a child class (subclass) of a parent class (base class) in which subclass inherits properties and methods of parent class.

Subclass: A class that is derived from another class is called a subclass (derived class or extended class, or child class).

Base Class: The class from which the subclass is derived is called a base class (super class or parent class).

Advantage of inheritance:

  • Method Overriding (so runtime polymorphism can be achieved).
  • Code Reusability. (make the program small and clean) 


A Car has all the features of a vehicle. If we define a base class ‘Vehicle’ and a ‘Car’ class which derived from ‘Vehicle’. Then the ‘Car’ class inherits the features of ‘Vehicle’ class and also has its own attributes. We can also extend the ‘Car’ class to ‘Sports Car’ which inherits the features of both ‘Vehicle’ and ‘Car’ classes.

Syntax (Java):

class Subclass-name extends Superclass-name  
   //methods and fields  

Webster Dictionary Meaning

1. Inheritance
- The act or state of inheriting; as, the inheritance of an estate; the inheritance of mental or physical qualities.
- That which is or may be inherited; that which is derived by an heir from an ancestor or other person; a heritage; a possession which passes by descent.
- A permanent or valuable possession or blessing, esp. one received by gift or without purchase; a benefaction.
- Possession; ownership; acquisition.
- Transmission and reception by animal or plant generation.
- A perpetual or continuing right which a man and his heirs have to an estate; an estate which a man has by descent as heir to another, or which he may transmit to another as his heir; an estate derived from an ancestor to an heir in course of law.
Share it:  Cite

More from this Section

  • OOP Class
    OOP Class is the short form for Object-Oriented Programming Class in the highly popular ...
  • Programming Language
    Programming Language is a language used to give instructions to computers. Which means ...
  • Procedural programming
    Procedural programming is a concept of programming that specifies a ...
  • Computer-Aided Engineering (CAE)
    Computer-Aided Engineering (CAE) refers the use of computers to guide or control the actual ...
  • C# Programming
    C# (pronounced “C sharp”) a programming language developed by Anders Hejlsberg (the ...