Which object-oriented programming principle combines data and the functions that operate on that data into a single unit?

Options

  • A. Inheritance
  • B. Polymorphism
  • C. Encapsulation
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Encapsulation

Detailed Explanation

Correct Answer: Option C

Explanation:
Encapsulation combines data members and member functions into a class and controls access to the internal state through access specifiers such as private and public. Inheritance supports code reuse, while polymorphism allows one interface to have different behaviors.