What is Inheritance




What is Inheritance

In OOPs, a class can be divided into sub classes. In C++, the original class is called the base class; other classes can be defined that share its characteristics but add their own as well. These are called derived class. This is only available in OOPs. In structured programming , we can't derive any function from already created function.

e.g. Cars, trucks buses and motorcycles all have wheels and a motor; these are defining characteristics of vehicles. In addition to characteristics shared with other members of the class, each sub class also has its own particular characteristics : buses have seats for many people, while trucks have space for hauling heavy loads.