Which of the following statements related to C++ is FALSE?

2019

Which of the following statements related to C++ is FALSE?

Answer: D. Constructors can be virtual, but destructors cannot.Answer: The statement "Constructors can be virtual, but destructors cannot" is false. Explanation: Constructors cannot be virtual. Virtual dispatch relies on…

  1. A.

    Destructors have the same name as their class, preceded by a tilde (~) character.

  2. B.

    Destructors can be virtual, but constructors cannot.

  3. C.

    Constructors have neither “return” value nor “void”.

  4. D.

    Constructors can be virtual, but destructors cannot.

Attempted by 334 students.

Show answer & explanation

Correct answer: D

Answer: The statement "Constructors can be virtual, but destructors cannot" is false. Explanation: Constructors cannot be virtual. Virtual dispatch relies on the object's virtual table, which is not fully established during construction, and the language disallows declaring constructors as virtual.

Explore the full course: Bpsc

Loading lesson…