Which function is called automatically when an object goes out of scope in C++?

Explanation:

The destructor (~ClassName) is automatically invoked when an object is destroyed.

Explore more in Computer Science: