C++ Inheritance

 Inheritance

Inheritance is the mechanism in which new class adopt the properties of the old class. It is the capability of a class to derive properties and characteristics from another class. Inheritance is one of the most important feature of object oriented programming. The derive class inherited the features of the base class and can have additional features of its own. 

Inheritance is an "is a" relationship. We use Inheritance only if an is a relationship is present between two classes. Here, are some examples-

A car is a vehicle.

Car----derive class

Vehicle----base class

The main advantages of inheritances are code reusability and readability when child class inherit the properties of functionality of parent class, we need not to write the properties of functionality of parent class, we need not to write the same code again in child class.







Comments

Post a Comment

Popular posts from this blog

Introduction of C Language

First in C programming

Computer generation