Q
Which C++ members can be declared virtual?
-
A
Both can
-
B
Neither can
-
C
Destructors can be virtual; constructors cannot
-
D
Constructors can be virtual; destructors cannot
Correct Answer:
C. Destructors can be virtual; constructors cannot
Explanation:
A base class used polymorphically should have a virtual destructor, so deleting through a base pointer calls the derived destructor.