Which of the following is true about constructors in C++ ?
2025
Which of the following is true about constructors in C++ ?
- A.
Constructors can return values
- B.
A constructor has the same name as the class
- C.
Constructors must have parameters
- D.
Constructors can be invoked explicitly
Attempted by 44 students.
Show answer & explanation
Correct answer: B
C++ constructors are special member functions used to initialize objects. They have the same name as the class and do not return a value, even void.