| int main(int argc, char** argv) { using namespace std; TimeStamp theTimeStamp; // object created here theTimeStamp.update(); long theTime = theTimeStamp.get(); if (theTime > 0) { cout « "seconds from 1/1/1970: " « theTime « endl; } return 0; } // object destroyed before brace (scope end) | 
Constructor and destructor code: 
  
 	TimeStamp::TimeStamp() {  
 
std::cout « "TimeStamp object constructed at address " 
	   « this « std::endl; 
	} 
TimeStamp::
 TimeStamp() {
TimeStamp() {  
std::cout « "TimeStamp object at address " 
	   « this « " destroyed" « std::endl; 
	}
  
Output: 
  
	TimeStamp object constructed at address 0xbffff24c 
 
seconds from 1/1/1970: 1157281160 
TimeStamp object at address 0xbffff24c destroyed