For an object, its destructor is called when it goes out of scope. Here\'s my program:
#include using