Encapsulation
Encapsulation means object acting as a container for its features (variables and methods). Objects cannot see other objects variables and their method implementations. But objects can exchange things between each other through public methods. Here a public method acts as door between 2 objects. But the public method will not show other object the steps it will take to give the output.
As shown in the above figure, it is similar to a customer going to a canteen and ordering a cup of tea over the counter. Here the customer does not know how the canteen prepares a cup of tea. He only knows how to order a cup of tea.
Resources
No comments:
Post a Comment