“Encapsulation is defined as the process of binding the data and code together”. The concept of class achieves this. Member fields are treated as data and member functions are treated as
code. Both the members are protected from the external access by various access privileges. “Encapsulation is the process of grouping your application into logical parts”, “Encapsulation is
protecting the data members from external misuse”.
And, “Encapsulation is about separating information from other parts of the application that you want not to mess with that information. Encapsulation is not only protecting the data but, it's actually separating the data in such a way that there is no way to misuse them. The idea is, concern mainly with separation rather than protection but, ultimately you should attain protection”.