top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

What is the purpose of using a destructor in c++?

+1 vote
posted Aug 11 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

To take care of garbage collection in c++

The main purpose of destructor is to free all the resources which you have allocated during your object's life time. Example: Freeing resources like memory allocations, opened files, opened sockets, database connections, resource locks etc..)

answer Aug 11 by Manikandan J
Similar Questions
0 votes

What is a pure virtual destructor in C++? What is its need, advantage and disadvantage, please explain with example?

0 votes

Find the first non repeating character in a string.

For example
Input string: "abcdeabc"
Output: "e"

Useful Links with Similar Problem
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.