Tuesday, 17 March 2015

What Is Inheritance In Oops? Real Time Example? Program ? Advantages And Disadvantages?

                In the Previous Post Freshers Junction blog gives full detailed description about “Difference Between Method Overloading and Overriding”. That question is frequently asked question in Technical interview. Freshers Junction blog hope you people can get clear Ida about Difference Between Method Overloading and Overriding.
                Now freshers Junction blog discuss about What is inheritance in Oops? Real-time Example? Advantages And Disadvantages?. This Question is the commonly asked question in technical interview. about What is inheritance in Oops? Real-time Example? Advantages And Disadvantages? Question is a basic question in Oops. The interviewer asked this question to you to check whether you  are eligible to take interview or not. If you are given satisfying answer for this question interviewer continues Interview with some other questions else interviewer says “You can leave for the day”. Freshers remember this question have that much of importance.
                Now we can enter into the concept of What Is Inheritance In Oops? Real Time Example? Advantages And Disadvantages?

What Is Inheritance In Oops?

                One class (child class) inherits or acquire the property (members) of another class is known as Inheritance.

Example program Inheritance:

                Here we provide example program for inheritance , which can describes the parent and child class relationship.

Output for Inheritance Program:

The output for above inheritance Oops program is
                                Parent constructor
                                Child Constructor
                                I’m Parent Class

Real Time Example:

The real time example for Inheritance is “parent child relationship”. Because child receives all the property from parent.             

Advantages of Inheritance:

- Inheritance is the process of object reusability
- Inheritance reduce code redundancy
- Inheritance reduce the size of program code
- Inheritance helps in adding additional features to an existing class without modifying it

Disadvantages of Inheritance:

- In the concept of Inheritance , Both child class and parents class are tightly coupled. If you modify the program code in parent class then all child classes are effected, because those child classes are inheriting from parent class.


                Before going to any interview you can check this page, then it will easy to answer this question in Technical interview. Press Ctrl+D to bookmark this page. One More important point is whenever interviewer asking about Inheritance, don’t give simply definition of Inheritance, you can tell all about Inheritance, which is in this article that is definition of Inheritance, Advantages of Inheritance, Disadvantages of Inheritance, Example program of Inheritance, Real time example of Inheritance. Then only you have more chances to crack interview. All the Best!!!

                If you have any queries comment here, Freshers junction is here to help you.  

You may also in Google about this Concept as:
 FreshersJunction Inheritance with Real time example, What is inheritance in Oops, inheritance concept with example program, Inheritance advantages in Oops, Inheritance disadvantages in Oops Java .Net, Inheritance program with advantages and disadvantages. The best real time example for Inheritance.


Submit Your Email ID Here