It is up to the program's designer to make sure the interface is sufficiently narrow to guarantee encapsulation. Given specifications for the object's narrow interface, and its behavior, the object can be debugged and tested in isolation, without regard to the rest of the program. This makes the program much more reliable and maintainable. One of the many methods of providing encapsulation is to make all the class's variables unavailable to other classes, but instead to provide input and output of those variables through a method. The simplest way to explain Inheritance is by analogy.
Inheritance facilitiates classification.
For instance, an engined vehicle is a vehicle with an engine. A tracked vehicle is a land vehicle with tracks. I emphasized the words is a . This is because in every well done job of inheritance, the subclass is a type of the superclass with some added feature or behavior. Imagine the possibilities for code re-use.