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.
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.
Try Another Word