Everything About ___
Live briefing

Everything about Destructor (computer programming)

Function called at the end of an object's lifetime

In object-oriented programming, a destructor is a method which is invoked mechanically just before the memory of the object is released. It can happen either when its lifetime is bound to scope and the execution leaves the scope, when it is embedded in another object whose lifetime ends, or when it was allocated dynamically and is released explicitly. Its main purpose is to free the resources which were acquired by the object during its life and/or deregister from other entities which may keep references to it. Destructors are necessary in resource acquisition is initialization (RAII). Wikipedia →

đź§­ Start here: a 6-step reading path

  1. Read the overview: Destructor (computer programming)A 5-minute orientation
  2. Pick up a classic book: Learning PHP, MySQL & JavaScriptThe most-reprinted book on the subject
  3. Go sideways: Resource acquisition is initializationA closely related topic
  4. Go sideways: Run-time type informationA closely related topic

đź“– Definitions

No dictionary entry for this exact phrase.

🗂️ The subject at a glance

  1. Syntax
  2. Language details

🏆 Landmark papers (most cited)

📚 Books worth reading

Ranked by number of editions on Open Library, a rough measure of how lasting a book is.

đź”— Related topics