In c++ Can a class have more than one destructors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In c++ Can a class have more than one destructors?

class usualy have one destructor. can it have more than one?

10th Aug 2017, 4:20 PM
MNaveed
MNaveed - avatar
4 Answers
+ 7
Why would you want to have more than one destructor? When your program wants to call the destructor upon program exit, how is it supposed to know which one to call?
10th Aug 2017, 4:22 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
why would you need more than one? btw the answer is no.
10th Aug 2017, 4:22 PM
jay
jay - avatar
+ 1
thanks guys i was asked this question so i asked it from u guys.. my answer was no . but without a reason
11th Aug 2017, 5:32 PM
MNaveed
MNaveed - avatar
0
No.
17th Aug 2017, 7:23 PM
Ahmet
Ahmet - avatar