+ 4
What is the use of destructor?
2 Answers
+ 9
It can be used to release any resources acquired in the constructor that don't release themselves. E.g., file handles, database connections, etc.
+ 2
when the object is finally destroyed the destructor is called and the code inside it is executed. Most of the time it is used to close file streams and database connection