Encapsulation in the mechanism that binds together code and data and that leaps both safe from outside interference or misuse. It also allows the creation of an object. More simply, an object in a logical entity that encapsulate both data and the code that manipulators that data.
Within an object, some of the code and/ or data may be private to the objected and in accessible to anything outside the object. In this way and object provides a significant level of protection against some other unrelated part of the program accidentally modifying or incorrectly using the private parts of the object.