---
title: "Define Destructors?"  
description: "Define Destructors?"  
author: "Shikhar Arora"  
published: 2019-12-06  
canonical: https://answers.mindstick.com/qa/92526/define-destructors  
category: "technology"  
tags: ["software engineering", "programming language"]  
reading_time: 1 minute  

---

# Define Destructors?

[Define](https://answers.mindstick.com/qa/72286/for-define-what-rats-and-rabbits-use-their-claws) Destructors

## Answers

### Answer by Sangsaptak Pal

[Destructor](https://en.wikipedia.org/wiki/Destructor_(computer_programming)) is the antonym to [Constructor](https://en.wikipedia.org/wiki/Constructor_(object-oriented_programming)) both in name ans meaning.

Constructor is a special method that initializes the data members of the class and thus allocates the memory space to them.

On the other hand, destructor is a member function which destructs or deletes an object.

A destructor is automatically called when:

- the function ends
- the program ends
- a delete operator is used
- a block containing the local variables end

They are usually named with the same name as the class name preceded by a tilde (~).


---

Original Source: https://answers.mindstick.com/qa/92526/define-destructors

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
