GP OOPS C++ Encapsulation Interview
GP OOPS C++ Encapsulation Interview
Abstraction Encapsulation
1
4. Are there any limitations of Inheritance?
Yes, with more powers comes more complications. Inheritance is a very powerful
feature in OOPs, but it also has limitations. Inheritance needs more time to
process, as it needs to navigate through multiple classes for its implementation.
Also, the classes involved in Inheritance - the base class and the child class, are
very tightly coupled together. So if one needs to make some changes, they might
need to do nested changes in both classes. Inheritance might be complex for
implementation, as well. So if not correctly implemented, this might lead to
unexpected errors or incorrect outputs.
2
a. Inheritance represents the parent-child relationship between two classes. On
the other hand, polymorphism takes advantage of that relationship to make the
program more dynamic.