General Definition
In general, encapsulation is one of the 4 fundamentals of OOP (object-oriented programming). Encapsulation is to hide the variables or something inside a class, preventing unauthorized parties to use. So the public methods like getter and setter access it and the other classes call these methods for accessing.
This mechanism is not unique to object-oriented programming. Implementations of abstract data types, e.g. modules, offer a similar form of encapsulation. This similarity stems from the fact that both notions rely on the same mathematical fundament of an existential type.
Read more about this topic: Encapsulation (object-oriented Programming)
Famous quotes related to general definition:
“The following general definition of an animal: a system of different organic molecules that have combined with one another, under the impulsion of a sensation similar to an obtuse and muffled sense of touch given to them by the creator of matter as a whole, until each one of them has found the most suitable position for its shape and comfort.”
—Denis Diderot (17131784)