It’s explained in your favorite C++ tutorial in section 6.9.
More Related Contents:
- Dynamically allocating an array of objects
- Is there a reason to call delete in C++ when a program is exiting anyway?
- Is it possible to delete a non-new object?
- Does delete on a pointer to a subclass call the base class destructor?
- Why, really, deleting an incomplete type is undefined behaviour?
- How do malloc() and free() work?
- What is the difference between new/delete and malloc/free?
- Is delete[] equal to delete?
- How could pairing new[] with delete possibly lead to memory leak only?
- Why do we need a pure virtual destructor in C++?
- Compelling examples of custom C++ allocators?
- How to get available memory C++/g++?
- How does a C++ reference look, memory-wise?
- Does C++ call destructors for global and class static variables?
- Any reason to overload global new and delete?
- Are memory leaks “undefined behavior” class problem in C++?
- When is an object “out of scope”?
- Check if a pointer points to allocated memory on the heap
- Is a destructor called when an object goes out of scope?
- Why do un-named C++ objects destruct before the scope block ends?
- Reason why not to have a DELETE macro for C++
- What is “bit padding” or “padding bits” exactly?
- How is it possible (if it is) to implement shared_ptr without requiring polymorphic classes to have virtual destructor?
- How do I call the original “operator new” if I have overloaded it?
- How to alloc a executable memory buffer?
- Are destructors run when calling exit()? [duplicate]
- How to check memory allocation failures with new operator?
- Memory-efficient C++ strings (interning, ropes, copy-on-write, etc) [closed]
- C++ is it necessary to delete dynamically allocated objects at the end of the main scope?
- Is the whole object freed with a non-virtual destructor and a Base class pointer?