Top "Destructor" questions

A special method in object-oriented programming which is invoked when an object is destroyed

When is a C++ destructor called?

Basic Question: when does a program call a class' destructor method in C++? I have been told that it is …

c++ destructor
Is calling destructor manually always a sign of bad design?

I was thinking: they say if you're calling destructor manually - you're doing something wrong. But is it always the …

c++ coding-style destructor
How to write a simple class in C++?

I have been reading a lot of tutorials on C++ class but they miss something that other tutorials include. Can …

c++ constructor destructor public private-members
How do you query a pthread to see if it is still running?

In my destructor I want to destroy a thread cleanly. My goal is to wait for a thread to finish …

c multithreading concurrency pthreads destructor
Why do we need a pure virtual destructor in C++?

I understand the need for a virtual destructor. But why do we need a pure virtual destructor? In one of …

c++ destructor pure-virtual
calling destructor explicitly

I understand that in most cases, we should not call a destructor explicitly. However, I saw an example from C++11 …

c++ destructor
C++ Constructor/Destructor inheritance

EDIT : Summary of answers In the following, B is a subclass of A. It's a matter of terminology; ctors and …

c++ inheritance constructor destructor
Pure virtual destructor in C++

Is it wrong to write: class A { public: virtual ~A() = 0; }; for an abstract base class? At least that compiles in …

c++ polymorphism destructor pure-virtual
What is the use of having destructor as private?

What is the use of having destructor as private?

c++ private destructor
Manually destroy C# objects

I am fairly new to learning C# (from Java & C++ background) and I have a question about manual garbage …

c# destructor idisposable using