All mock tests are FREE till 31 December — register to save your progress
Unit 3 · Programming Languages and Computer Graphics Paper 2 CS · June 2024 (Re-Exam)

Which of the following are TRUE about constructors in C++ ?

(A) A constructor can be overloaded.

(B) A constructor does not have a return type.

(C) A constructor must be declared as a friend function.

(D) A constructor is called when an object is destroyed.

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. (A), (B) Only

Explanation

Constructors can be overloaded and have no return type. They need not be friends, and they run when an object is created — destructors run when it is destroyed.

More Programming Languages and Computer Graphics questions