Advertisements
Advertisements
प्रश्न
'Encapsulation reduces the complexity and makes the system easier'. Explain this statement with a real world example.
थोडक्यात उत्तर
उत्तर
- Encapsulation combines procedures and data into a single object while limiting direct access to some parts of the object.
- Let's use an ATM as an example. To withdraw money from an ATM, we swipe our card, enter the PIN, and enter the desired quantity of cash.
- The ATM processes our request and provides us with the necessary funds. In this case, money is handled as data, and the techniques include pin and account balance checks, user authentication verification, and more.
- The ATM (handled as a class) contains the methods and data. Encapsulation lowers complexity and improves the system's usability (ATM) by removing the need for the user to understand how the machine operates.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1.01: Introduction to Object Oriented Programming Concepts - EXERCISES [पृष्ठ ९]