Can destructors not be initialized? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 4

Can destructors not be initialized?

If destructors can't be initialized, then what is the essence of ~CLASS ?

5th Apr 2018, 4:26 PM
Abraham N. Mulbah
Abraham N. Mulbah - avatar
2 Respostas
+ 1
Destructor gets called automatically when program ends or '}' closing bracket is encounter. Hence, there is no need for calling Destructor. Working : Destructor is a special member function whose task is to destroy the object created by constructor.
24th Apr 2018, 12:45 PM
Jayesh Patil
Jayesh Patil - avatar
A destructor will be executed when a object gets deleted
5th Apr 2018, 4:49 PM
Aaron Eberhardt
Aaron Eberhardt - avatar