1.

What is inheritance? Explain any two types of inheritance.

Answer»

In object-oriented programming, inheritance is a way to form new classes using classes that have already been defined.
1. Single inheritance:
A derived class with only one base class is called single inheritance. For example, If A is base class then class B derive from base class A.

2. Multilevel inheritance:
A class can be derived from another derived class which is known as multilevel inheritance. For example, The derived class C inherit B class whereas B is derived from class A.



Discussion

No Comment Found

Related InterviewSolutions