第4个回答 2012-07-20
Are you in the middle of an exam? Haha just curious.
It really depends on where you declare the variable, heap or stack?
The destructor will always be called for stack local variables, in anther word, a local variable's memory resource is auto-collected after the termination of the according fucntion.
However if you declare something on the heap for example malloc or new, a programmer has to release the memory resource manually otherwise, this will make the memory space accessable to functions outside the local function.