Whats the use of pure virtual desrructor | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Whats the use of pure virtual desrructor

Hi We cant ommit definition of destructor and hence we have to provide function body for pure virtual destructor. Now query is for the purpose of pure virtual destructor.... if body is needed , why to allow it at all ? Any specific purpose to do so?

5th Aug 2022, 5:58 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Réponse
+ 1
Maybe if you make an interface like class which is a generic container, it will force children classes to define it? edit: it indeed forces it
27th Aug 2022, 6:56 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar