In C++, what does a class hold?

2023

In C++, what does a class hold?

  1. A.

    Array

  2. B.

    Data

  3. C.

    Data and functions

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 803 students.

Show answer & explanation

Correct answer: C

In C++, a class is a user-defined data type that can hold both data members (variables) and member functions (methods). Data members store the state of an object, while member functions define the behavior. This combination allows classes to encapsulate data and operations together, forming the basis of object-oriented programming.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs

Loading lesson…