English

What is Destructor? - Computer Science 1

Advertisements
Advertisements

Question

What is Destructor?

Short Answer
Advertisements

Solution

  1. A destructor, as the name suggests, is used to remove or destroy objects that are created by a constructor.
  2. The destructor is automatically called by the compiler when the program ends or when an object of the class goes out of scope, in order to free memory that is no longer needed.
  3. It is considered a good programming practice to define destructors, as they help in releasing memory space for future use.
shaalaa.com
  Is there an error in this question or solution?

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×