Encapsulation is a fundamental principle of OOP that involves bundling data (attributes) and methods (functions) that operate on the data into a single unit or class. It also restricts direct access to some components of the object, typically by declaring them private or protected. Access is then controlled through public methods known as getters and setters. Encapsulation ensures security and prevents unauthorized or accidental modification of data. For instance, in a class BankAccount , the balance attribute might be private, and only specific methods like deposit() or withdraw() are accessible to modify it. This safeguards the integrity of the data and prevents incorrect usage. Why Other Options Are Wrong Option A : "Polymorphism" Polymorphism deals with methods behaving differently for different object types, not with restricting access. Option C : "Inheritance" Inheritance allows a child class to use the properties and methods of a parent class but does not involve controlling access to data. Option D : "Abstraction" Abstraction hides complexity by exposing only essential features. However, encapsulation is specifically about access control at the data and method level. Option E : "Message Passing" Message passing refers to the communication between objects in OOP but does not control access to internal object components.
What is the total dividend paid by LIC to the Government of India for the financial year 2023-24?
India has improved on the World Bank‘s Logistic Performance Index (LPI) 2023.It now ranks _____ from 44th on the index in 2018 in the 139 countries in...
As of March 2024, what percentage of Bharatmala Pariyojana Phase-I has been completed?
Who won Booker Prize 2021 for the book “The Promise”?
Under the Namo Drone Didi Scheme, what percentage of the drone cost is subsidized, and what is the maximum subsidy amount available per drone?
What is the primary objective of the report titled 'Illegal Trade of Red Sand Boa in India 2016-2021' by the Wildlife Conservation Society (WCS)-India?
The cabinet has hiked the Minimum Support Prices (MSP) for all mandated Rabi Crops for Marketing Season 2024-25. Which of the following statements is/...
According to Reserve Bank data, the credit to medium industries in June grew by _______ and micro and small industries by 13 per cent (29.2 per cent a y...
India and Asian Development Bank have signed a $125 million loan agreement to improve urban services in which of the following states?
Which indigenously developed explosive was successfully tested by the Indian Navy, marking a significant achievement in India's defense self-reliance?