L3Harris Interview Question

What is the difference between inheritance and encapsulation?

Interview Answer

Anonymous

Feb 3, 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