Which statement about constructors in C++ structures and classes is correct?

Options

  • A. Only classes can have constructors
  • B. Both structures and classes can have constructors
  • C. Neither structures nor classes can have constructors
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Both structures and classes can have constructors

Detailed Explanation

Correct Answer: Option B

Explanation: Both struct and class types can define constructors, destructors, member functions, and other class-type features. The default access level is the key distinction, not whether constructors are allowed.