Which OOP concept in C++ 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

Answer: Encapsulation

Encapsulation means combining data and the functions that operate on that data into a single unit, generally a class.

It also helps control access to data using access specifiers such as private, protected and public.