I search a complete description on the concept of encapsulation and i see that the answers found are somehow like pieces of puzzle and must be put together. I found the fallowing descriptions of this concept:
Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. (source tutorialspoint)
A language mechanism for restricting access to some of the object's components A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data. (source wikipedia)
Encapsulation allows an object to separate its interface from its implementation. The data and the implementation code for the object are hidden behind its interface.
Encapsulation is a technique. It may or may not be for aiding in abstraction, but it is certainly about information hiding and/or organisation. It demands data and functions be grouped in some way - of course good OOP practice demands that they should be grouped by abstraction. However, there are other uses which just aid in
maintainability etc. (source stackoverflow)
In procedural programming is mainly the same i think and here the best example is the FILE struct that is created or modified only by the file functions.
I was wondering what else could be added to have a complete image of this programming concept because it's very useful to know it in specially at designing a API or an interview question.