0
How to delete an object in C++?
Hi, I need to destroy an non-pointer object, but I couldn't find any answer. Could you help me please?
3 Réponses
+ 2
You can't. But why do you want to?
You could assign something else to it, which will delete the previous object, but really, what's the point?
+ 2
Instead of deleting it, assign new value to the object. You can also try separating scopes if it is possible in your code. Cuz you should know that variable lives in the scope in which it is declared only
0
XXX I want to make another object with different value, but I won't Loss memory for existence of older objects