Start learning 50% faster. Sign in now
Encapsulation is a key OOP principle that involves combining data (fields) and methods (functions) into a single unit (class) and controlling access to them using access modifiers like private, protected, and public. For instance, a BankAccount class might hide its balance field (using private access) and expose methods like deposit() and withdraw() to manipulate it. Encapsulation ensures data integrity and security , preventing unauthorized access or modifications. Why Other Options Are Incorrect : 2. Allowing multiple objects to interact through message passing : This describes Message Passing , which focuses on communication between objects. 3. Hiding complex implementation details from the user : This is Abstraction , not Encapsulation. 4. Enabling a class to inherit properties and methods from another class : This refers to Inheritance , unrelated to Encapsulation. 5. Defining a one-to-many relationship between objects : This aligns with Aggregation or Composition , not Encapsulation.
What pledge does the “Bal Vivah Mukt Bharat” campaign aim to achieve?
Who is the MD & CEO of Karnataka Bank?
What is the theme for International Literacy Day 2024?
How many locations have been provisionally identified for development of Gati Shakti Multi-Modal Cargo Terminal’ (GCT)?
Which entity sponsors the highest number of Regional Rural Banks (RRBs) in India?
UP set to get its third international cricket stadium at which place?
Before SEBI came into existence, which of the following was the regulatory authority for capital markets?
Consider the following about Pradhan Mantri MUDRA Yojana (PMMY):
I. It is a scheme launched in 2014 for providing loans.
II. It providing ...
On which occasion did the Prime Minister inaugurate the 2550th Bhagwan Mahaveer Nirvan Mahotsav?
India ended the Commonwealth Weightlifting Championships 2021 with ____ medals at Tashkent.