We are already familiar with the term abstraction. This abstraction concepts also brings another important idea in C++, the encapsulation. Encapsulation is a method of binding the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse.

As we know encapsulation hides the implementation details of the object and the only thing that remains externally visible is the interface of the object (i.e. the set of all messages the object can respond to). Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessible via the interface of the object. The only way to access such an encapsulated object is via message passing- one sends a message to the object, and the object itself selects the method by which it will react to the message,determined by functions.

Encapsulation means as much as shielding. Take a simple example. Say Customer, waiter and kitchen are three objects. As we know customer and kitchen do not know each other in general situation. The waiter is the intermediary between them. Objects can't see each other in an Object Oriented world. The 'hatch' enables them to communi- cate and exchange coffee and money.

Encapsulation keeps computer systems flexible. The business proe can change easily. The customer does not care about the cos Object-Oriented Programmin Introduc possible to change the entire business process. Suppose the wait will brew coffee himself.