Which statement about a class object in C++ is correct?

Options

  • A. An object is an instance of a class
  • B. A class object must always be a global variable
  • C. An object cannot contain data belonging to its class
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. An object is an instance of a class

Detailed Explanation

Answer: (A) An object is an instance of a class

A class defines a user-defined type, while an object is an instance of that type.

For example:

class Student { };

Student s1;

Here, Student is the class and s1 is an object of that class.

The object represents a particular instance of the class and has storage for the applicable non-static data members.