What is the advantage of using the destructor? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is the advantage of using the destructor?

10th Feb 2016, 10:44 PM
Mohammed Alghazzawi
Mohammed Alghazzawi - avatar
2 Respostas
+ 2
I want to extend the answers of my two predecessors: they mean *dynamically* allocated variables, i.e. via new operator, or if you like dirty C, malloc. :-) Static or local variables are automatically taken care of.
15th Jun 2016, 8:14 PM
Stefan
Stefan - avatar
+ 1
releasing resources aquired at time of construction of object and other lifetime of object
11th Jun 2016, 5:50 AM
Ganesh K
Ganesh K - avatar