Can you call a destructor in C++ 2024?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at the University of São Paulo, Lives in São Paulo, Brazil.
Local objects are automatically destroyed by compiler when they go out of scope and this is the guarantee of C++ language. In general, special member functions shouldn't be called explicitly. Explicit call to destructor is only necessary when object is placed at particular location in memory by using placement new.
2023-05-09 10:26:10
评论(499)
Helpful(122)
Helpful
Helpful(2)

Daniel Adams
QuesHub.com delivers expert answers and knowledge to you.
Local objects are automatically destroyed by compiler when they go out of scope and this is the guarantee of C++ language. In general, special member functions shouldn't be called explicitly. Explicit call to destructor is only necessary when object is placed at particular location in memory by using placement new.