destructor is a special member that runs when an object is destroyed. Its name is ~ClassName(). It has no return type and no parameters. It releases resources such as memory, files, and sockets. It is called automatically at scope end or by delete for heap objects. You cannot overload it. In polymorphic bases make it virtual. This enables RAII acquire in the constructor, release in the destructor. In GC languages the similar concept is a finalizer like __del__.