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.
Consider the following statements:
1. Water has high specific heat capacity of than ice
2. Heat capacity of cooking oil is lower than the ...
How is the return on debentures determined?
From point X, a person walks 45 m towards the east. He then takes a left turn and walks 40 m. He then takes a right turn and walks 90 m. He then takes a...
Sum of the present ages of A, B, C and D is 60 years. After 6 years ratio of their ages is 5:4:3:2. What is C’s present age?
“Order of Logohu” is the highest civilian award of which country?
What is the specific name of the cryogenic engine that was tested by Skyroot Aerospace using 3D printing technology?
With the 41% of global production, Which of the following country has become the largest producer of pearl millets(Bajra)?
Under which five-year plan was Bharat Nirman started by the Government of India to upgrade rural infrastructure?
As per the Economic Survey 2022-23, which of the following statement is/are incorrect?
I. Unemployment rates fall fro...
Consider the following statements:
1. Tree of Liberty was planted by Tipu Sultan at Srirangapatnam
2. Jacobin Club of Mysore w...