Question:

What is the meaning of encapsulation in Object Oriented Programming?

Show Hint

Encapsulation is like a capsule for medicine. The plastic shell (the class) bundles the medicine (the data) and protects it from the outside world. You interact with it through a controlled interface (by swallowing it), not by directly touching the raw ingredients.
Updated On: Jul 2, 2026
  • Avoiding class usage
  • Using only public methods
  • Allowing global access to variables
  • Hiding implementation details
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Encapsulation is one of the fundamental principles of Object-Oriented Programming (OOP). It refers to two related but distinct concepts:
1. Bundling: Grouping together the data (attributes) and the methods (functions) that operate on that data into a single unit, which is called a class. 2. Data Hiding: Restricting direct access to some of an object's components. This is typically achieved by making the data members `private` and providing `public` methods (getters and setters) to access or modify the data in a controlled way.
This data hiding aspect is a crucial part of encapsulation. It protects an object's internal state from outside interference and misuse. By hiding the implementation details and exposing only a well-defined public interface, the class becomes easier to use and maintain.
Therefore, "Hiding implementation details" is the best description of the meaning of encapsulation among the given choices.
Was this answer helpful?
0
0