1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
xz_007 [3.2K]
3 years ago
5

. What is a destructor and what is its purpose?

Computers and Technology
1 answer:
NISA [10]3 years ago
5 0

Answer:

Destructor is a function or method which is used to deallocated the memory which is allocated by the constructor in the program.The destructor is used to delete the object or destruct the object.

Explanation:

The Purpose of Destructor is to delete the object from the memory which is created by Constructor.

The Destructor have same name as the class name in c++.

In c++ we use destructor like that

#include <iostream>

using namespace std;

class Hello

{

   public:

       Hello () //constructor defined

      {

     cout << "Hey constructor is called here:" << endl;

      }

      ~Hello() //destructor defined

      {

            cout << "Now destructor is called here:" << endl;

      }

};

int main()

{

    Hello h; //constructor is called

    cout << "function main is closing...." << endl;

   

    return 0;

}  

You might be interested in
What is Error Code: 232011
alexgriva [62]
Ummm what are you trying to ask? Is it like a error on your computer or-
5 0
3 years ago
Read 2 more answers
Who is primarily responsible for ensuring cybersecurity in society? Select 3 options.
svp [43]

Answer:

Explanation:

law enforcement organizations

cybersecurity specialists

individual users of technology

...bro if you thought it was jackers and fraudsters, i fear for you!!! lol.

7 0
3 years ago
How many tens are there in the number 156?<br> A. 1<br> B. 15<br> C. 6<br> D. 56
dexar [7]

Answer:

15

Explanation:

15 times 10 is 150, therefore there is 15 tens inside 156.

7 0
4 years ago
Read 2 more answers
The first row of a table is often called the _____ row.
satela [25.4K]

ANSWER:

The first row of a table is often called the header row.

~batmans wife

7 0
3 years ago
Read 2 more answers
Rachel is on her way to an interview for the position of a project manager. She is trying to prepare for this interview by analy
Fittoniya [83]

The answer would be A.


5 0
3 years ago
Other questions:
  • write code to declare variables for s0 with a value of 12.0, v0 with a value of 3.5, a with a value of 9.8, and t with a value o
    13·1 answer
  • Use induction on n to prove that fir all n&gt;=2, 2^n+3^n&lt;5^n
    11·1 answer
  • How many bits are reserved for the Transmission Control Protocol (TCP) flags?
    11·1 answer
  • Which of the following statements about software licensing are true? Select 3 options.
    5·1 answer
  • Need help ASAP??? Pick the best answers
    10·1 answer
  • You want to substitute one word with another throughout your
    13·1 answer
  • Which statement is true about hacking?
    11·2 answers
  • State differences between title bar and menu bar​
    5·1 answer
  • Reality and computer-generated simulations can solve a lot of problems
    14·1 answer
  • A computer professional's job involves analyzing computer systems for
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!