Ask Question

Provide examples of the type of program statement that should be placed in a destructor.

+4
Answers (1)
  1. 11 December, 05:44
    0
    A destructor is called when there is a need to destruct or delete the object that is already created. As a Constructor is used to create an object, similarly a destructor is used to destruct the object. As there will be a default Constructor which is called when creating a new object, the default destructor is called to Destruct the object when the object goes out of scope or the function ends or program ends or a block containing that particular local variable ends or a delete operator is called. Examples for the destructor are (as the destructor contains delete operators)

    Examples : delete []s; In this example when the destructor is called, the delete operator will be called and the object created destructs.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Provide examples of the type of program statement that should be placed in a destructor. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers