In object-oriented programming (OOP), encapsulation refers to the practice of bundling the data (variables) and the methods (functions) that operate on that data into a single unit called a class. It also involves restricting access to some of the object's components, which is often done by making some properties or methods private, thereby hiding the internal implementation details from the outside world.
- Combining data and methods into a single unit (A) is a general description of encapsulation, but the focus is on hiding implementation details (B).
- Inheriting properties from a parent class (C) refers to inheritance, not encapsulation.
- Allowing multiple forms of a method (D) refers to polymorphism, not encapsulation.
Thus, the correct answer is (B).