L3Harris interview question

What is the difference between inheritance and encapsulation?

Interview Answer

Anonymous

3 Feb 2021

Inheritance vs. encapsulation: not related except both commonly found in OO languages. • Inheritance: IS-A relationship that extends by specializing in subclasses • Encapsulation is information-hiding in a class. Outside world is ignorant of implementation, only class/objects know and manipulate details.

1