Object-Oriented Programming (OOP)
What is the function or purpose of Encapsulation?
- A. An OOP concept that allows objects of different classes to be treated through a common interface.
- B. An OOP principle that hides complex implementation details and exposes only essential features.
- C. An OOP principle that bundles data and methods together while restricting direct access to some components. ✓
- D. An OOP mechanism that allows a class to acquire properties and behaviors from another class.
Correct answer
C. An OOP principle that bundles data and methods together while restricting direct access to some components.
Explanation
Encapsulation refers to an OOP principle that bundles data and methods together while restricting direct access to some components.