World's most popular travel blog for travel bloggers.

What is inheritance ? Explain its advantages.

, , No Comments
In object-oriented programming, inheritance is the concept that when a class of objects is defined, any subclass that is defined can inherit the definitions of one or more general classes. This means for the programmer that an object in a subclass need not carry its own definition of data and methods that are generic to the class (or classes) of which it is a part. This not only speeds up program development; it also ensures an inherent validity to the defined subclass object (what works and is consistent about the class will also work for the subclass).

Advantages of Inheritance. The most frequent use of inheritance is for deriving classes using existing classes, which provides reusability. The existing classes remain unchanged. ... When a class is derived from more than one class, all the derived classes have similar properties to those of base classes.


Post a Comment

Let us know your responses and feedback