What is the objective of encapsulation in object-oriented programming?
ATo create multiple instances of a class
BTo enable one class to inherit from another class
CTo allow objects to take multiple forms
DTo combine data and methods that operate on that data within a single unit
Show answerHide answer
Correct answer: (D) To combine data and methods that operate on that data within a single unit
Explanation
Encapsulation bundles data and the methods that act on it into one unit (class) and hides internal details. Inheritance and polymorphism are options B and C.