What is the use of virtual destructors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of virtual destructors?

10th Jun 2017, 4:20 PM
Gagan
Gagan - avatar
2 Answers
+ 1
a virtual destructor in a base class delegates the object destruction to the subclass that inherits from it. As a general rule of thumb, if you are inheriting from the class you should give it a virtual destructor.
13th Jun 2017, 5:35 AM
Sean Patrick Franklin
Sean Patrick Franklin - avatar
0
thanks
17th Jun 2017, 6:13 PM
Gagan
Gagan - avatar