NIOS Computer Science: Chapter 14 – Inheritance Extending Classes Part 1

Download PDF of This Page (Size: 301K)

Image of Inheritance

Image of Inheritance

Image of Inheritance

This lesson discusses about inheritance, the capability of one class to inherit properties from another class as a child inherits some properties from his/her parents.

The most important advantage of inheritance is code reusability.

Once a base class is written and debugged, it can be used in various situations without having to redefine it or rewrite it.

Reusing existing code saves time, money and efforts of writing the code again.

Without redefining the old class, you can add new properties to desired class and redefine an inherited class member function.

Objectives

After going through this lesson, you would be able to

Image of Inheritance Extending object

Image of Inheritance Extending Object

Image of Inheritance Extending object

Need for Inheritance

Inheritance is one of the important concepts of object-oriented language.

There are several reasons why this concept was introduced in object oriented language. Some major reasons are:

  1. The capability to express the inheritance relationship which ensures the closeness with the real world model.

  2. Idea of reusability, i.e., the new class can use some of the features of old class.

  3. Transitive nature of inheritance, i.e., it can be passed on further.

Developed by: