Destructor

/dɪˈstrʌktər/ noun

Definition

A special method that automatically runs when an object is destroyed or goes out of scope, typically used to clean up resources like memory, files, or network connections. It's the opposite of a constructor, handling the 'cleanup' when something is no longer needed.

Etymology

From Latin 'destruere' meaning 'to tear down,' from 'de-' (down, away) + 'struere' (to build). Introduced in C++ in the 1980s as the counterpart to constructors, handling the 'destruction' or cleanup of objects.

Kelly Says

A destructor is like the automatic cleanup crew that comes after a party - when the party (object) ends, someone needs to turn off the lights, lock the doors, and clean up the mess. The destructor does this automatically so you don't have to remember!

Related Words

Explore More Words

Get the Word Orb API

Complete word intelligence in one call. Free tier — 50 lookups/day.