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
- Read the overview: Destructor (computer programming)A 5-minute orientation
- Pick up a classic book: Learning PHP, MySQL & JavaScriptThe most-reprinted book on the subject
- Go sideways: Resource acquisition is initializationA closely related topic
- Go sideways: Run-time type informationA closely related topic
đź“– Definitions
No dictionary entry for this exact phrase.
🗂️ The subject at a glance
🏆 Landmark papers (most cited)
- No matching papers found.
📚 Books worth reading
Learning PHP, MySQL & JavaScriptRobin Nixon · 2009
Data structures and algorithm analysis in CMark Allen Weiss · 1993
The C# programming languageAnders Hejlsberg, Scott Wiltamuth · 2004
Software EssentialsAdair Dingle · 2014
Let Us C++Yashavant Kanetkar · 2002
Computer programming with C++Kunal Pimparkhede · 2017
A first course in computational physics and object-oriented programming with C++David Yevick · 2005
Data structures using C++D. S. Malik · 2010
Ranked by number of editions on Open Library, a rough measure of how lasting a book is.
đź”— Related topics
- Resource acquisition is initialization Resource acquisition is initialization (RAII) is a programming idiom used in several object-oriented, statically typed programming languages to describe…
- Run-time type information In computer programming, run-time type information or run-time type identification (RTTI) is a feature of some programming languages (such as C++, Object…
- C++/CLI C++/CLI is a variant of the C++ programming language, modified for Common Language Infrastructure. It has been part of Visual Studio 2005 and later, and…
- Method (computer programming) A method in object-oriented programming (OOP) is a procedure associated with an object, and generally also a message. An object consists of state data…
- Smart pointer In computer science, a smart pointer is an abstract data type that simulates a pointer while providing added features, such as automatic memory management…
- Variadic template In computer programming, variadic templates or variation generics are templates that take a variable number of type parameters. They exist in several programmin…
- Object lifetime In object-oriented programming (OOP), object lifetime is the period of time between an object's creation and its destruction. In some programming contexts…
- Singleton pattern In object-oriented programming, the singleton pattern is a software design pattern that restricts the instantiation of a class to a singular instance.…