+ 1
How destructors help to release memory?
.......
2 odpowiedzi
+ 3
The memory used to store old objects can be freed up to create new objects. As memory is a finite resource, releasing memory is important in software that can consume a lot of it.
0
If you dynamically allocate memory in a class(with new), you should free that memory (with delete) to prevent memory leaks. Usually, the class destructor is a good place to do that.