What is constructor? Explain how it is overloaded, with the help of a C++ program.

Constructor – Inheritance is a mechanism by virtue of which the classes inherit the attributes and methods of some other class(s).

In a sense, we can say, inheritance is a way to reuse the code of some existing or already defined classes.

The classes, in this case, are said to have ‘a-kind-of’ and ‘is-a’ relationship with the other classes.

Using this property of OOP, one class can extend other classes by including additional methods and/or attributes (variable).

The original class is called the ‘superclass’ of the extending class and the extended class is called the ‘subclass’ of the class that is being extended.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!