About 7,840,000 results
Open links in new tab
  1. c++ - When do we need to define destructors? - Stack Overflow

    When you need to do this, you must define the destructor to be virtual within the base class. Otherwise, your derived destructors won't get called, independent of whether they are defined …

  2. c++ - When to use virtual destructors? - Stack Overflow

    Jan 20, 2009 · In most implementations, the call to the destructor will be resolved like any non-virtual code, meaning that the destructor of the base class will be called but not the one of the …

  3. c# - When should I create a destructor? - Stack Overflow

    A destructor is then essentially an assurance that if the consumer of your object forgets to dispose it, the resource still gets cleaned up eventually. (Maybe.) If you make a destructor be …

  4. C++ Constructor/Destructor inheritance - Stack Overflow

    For trivial cases that destructor just calls the base class' destructor, and often that means that there is no explicit code for its destructor (which imitates inheritance). But if a class has …

  5. Do I need to explicitly call the base virtual destructor?

    When overriding a class in C++ (with a virtual destructor) I am implementing the destructor again as virtual on the inheriting class, but do I need to call the base destructor? If so I imagine it's

  6. How do I call the class's destructor? - Stack Overflow

    The destructor is something that is automatically called when your object goes out of scope, that is, when the computer leaves the "curly braces" that you instantiated your object in. In this …

  7. How do I correctly clean up a Python object? - Stack Overflow

    Specifically, I need Python to call the destructor for me, because otherwise the code becomes quickly unmanageable, and I will surely forget an exit-point where a call to .close () should be.

  8. Equivalent of destructors in JavaScript's object model

    Mar 9, 2023 · Since I've dealt in the past with JavaScript’s funky "object model", I assume there is no such thing as a destructor. My searches were mildly unsuccessful, so you guys are my last …

  9. Destructors and the delete() method in C++ - Stack Overflow

    Sep 28, 2016 · Yes, in this case, you still need to call delete in order to call the destructor and deallocate the memory.

  10. c# - How to call a destructor - Stack Overflow

    22 You don't call the destructor in .NET. The managed heap is handled by the CLR and the CLR only. You can, however, define a destructor to a class. The destructor would be called once …