Multiple choice technology programming languages

Which of the following exists in C++ ?

  1. virtual constructor

  2. virtual destructor

  3. both A and B

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

C++ supports virtual destructors but not virtual constructors. Virtual destructors ensure proper cleanup when deleting derived objects through base pointers, while constructors cannot be virtual since they initialize the vtable itself.