What is inheritance in oops

Inheritance: 

  • It’s a process of acquiring the features (data members and member methods) of one class into another class.
  • Inheritance process is also known as Extendibility or Reusability or Derivation or Sub-classing.
  • Whichever class is giving its features to another class is known as Base Class or Parent Class or Super Class.
  • Whichever class is acquiring the features from its base class is known as Derived class or Child Class or Sub Class.
  • It is strongly recommended to create an object of bottom most Derived Class by which we can access the features of derived class as well as the features of its base class.

 

ADVANTAGES:

  • Application Development time is very less.
  • Repetition/Redundancy of the codes will get reduced. Hence, Occupation of memory space will be reduced.
  • Investment cost towards project will be reduced.
  • The performance of overall project will be improved.

TYPES OF INHERITANCE:

  • SINGLE INHERITANCE: In this, there exists one Base Class and One Derived Class.

 

  • MULTILEVEL INHERITANCE: In this, there exists one Base Class, one derived class and n # Intermediate Base Classes.
    • Intermediate Base Class is one which acts as a derived class in one context and as a Base Class is some other context.

 

  • MULTIPLE INHERITANCE: Java doesn’t support multiple Inheritances to the classes directly but it supports indirectly through the Interface.  In this, there exists n # base classes and one derived class.

 

  • HIERARCHICAL INHERITANCE: In this, there exists one base class and n # derived class.

 

  • HYBRID INHERITANCE: It is a combination of two valid Inheritances.

2 Comments

  • I’m also commenting to make you be aware of what a useful encounter my child had reading your web page. She figured out a wide variety of pieces, which included what it is like to have a very effective coaching style to let other people without difficulty know just exactly chosen problematic matters. You truly surpassed our own expected results. Thanks for providing those precious, trustworthy, revealing and easy tips on this topic to Tanya.

  • I precisely wished to say thanks once again. I do not know what I might have made to happen without these aspects shared by you over such a area. Entirely was a fearsome issue in my position, however , coming across this skilled manner you treated it took me to jump with delight. Now i am happier for the information and in addition pray you recognize what an amazing job you are getting into teaching men and women thru a site. I am certain you’ve never met any of us.

Leave a Reply