All mock tests are FREE till 31 December — register to save your progress

Which of the statements are CORRECT?
(A) Constructors are invoked automatically when objects are created.
(B) Constructors do not have return types, not even void, and therefore cannot return values.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below:

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

Show answer & explanation

Correct answer: B. (A), (B) and (C) Only

Explanation

A, B and C are standard facts. Constructors cannot be virtual (destructors can).

More Programming Languages and Computer Graphics questions