Home / Questions / 'Encapsulation reduces the complexity and makes the system easier'. Explain this statement with a real world example.
Explanatory Question

'Encapsulation reduces the complexity and makes the system easier'. Explain this statement with a real world example.

👁 92 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Encapsulation means wrapping of data and methods into a single unit and restricting direct access to some of the object's components.

Let us take the example of an ATM machine. When we want to withdraw money from an ATM machine, we swipe our card, enter the pin and then enter the amount of money we want to withdraw. The ATM machine processes our request and gives us the required money.

Here, money is treated as data and the various processes such as verification of the authenticity of the user, pin and balance in the account etc., are the methods. The data and methods are encapsulated in the ATM (which is treated as a class). Since the user doesn't have to understand the actual working of the ATM machine, encapsulation reduces the complexity and makes the system (ATM machine) easier to use.