Which of the following exists in C++?
-
virtual destructor
-
virtual constructor
-
Both A and B
-
None of the Above
A
Correct answer
Explanation
C++ supports virtual destructors but not virtual constructors. Virtual destructors ensure proper cleanup when deleting derived class objects through base class pointers. Virtual constructors don't exist because you cannot construct an object without knowing its exact type at compile time - construction requires the complete type information.