+ 1

Why can't we declare destructor as private?

why compiler giving error when destructor is declared as private?

21st Apr 2018, 7:00 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
1 Odpowiedź
+ 3
Because it's implicitly called outside the class when an objects memory is freed.
21st Apr 2018, 7:01 PM
Timon Paßlick