what can we put in a destructor? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what can we put in a destructor?

Besides sending out a message, as the course example shows, what else can we or need to be put in a destructor?

18th Jan 2017, 3:25 PM
Ling Jiang
Ling Jiang - avatar
3 Answers
+ 1
Thanks for your reply, Rob. You are right, but freeing the memory is executed automatically by the destructor. I want to know what else can we do within the definition of a destructor.
18th Jan 2017, 3:34 PM
Ling Jiang
Ling Jiang - avatar
+ 1
Not if you manually allocate the memory. I haven't done that much with c#, but you should be able to do this.
18th Jan 2017, 3:36 PM
Robobrine
Robobrine - avatar
0
Most important one is probably deallocating memory.
18th Jan 2017, 3:30 PM
Robobrine
Robobrine - avatar