Which statement about constructors in C++ is correct?

Options

  • A. A constructor must always return an int.
  • B. A constructor has the same name as its class and has no return type.
  • C. A constructor must always be declared static.
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. A constructor has the same name as its class and has no return type.

Detailed Explanation

Correct Answer: Option B

Explanation:
A constructor has the same name as its class and does not declare a return type, not even void. It is normally called automatically when an object is created. Constructors cannot be static.