In object-oriented programming (OOP), encapsulation is the technique of packaging data (variables) and the methods (functions) that manipulate that data into a single entity known as a class. A key aspect of encapsulation is controlling access to an object's internal components, typically by designating certain properties or methods as private. This practice conceals the internal workings of the object from external entities.
- Bundling data and methods into a single unit (A) generally describes encapsulation, but its primary emphasis is on obscuring implementation details (B).
- Acquiring properties from a parent class (C) is known as inheritance, not encapsulation.
- Enabling a method to take on multiple forms (D) is termed polymorphism, not encapsulation.
Therefore, (B) is the accurate selection.