Wednesday 22 February 2012

Explain how would you handle a situation where you cannot call the destructor of a local explicitly? | Constructor in C++

To avoid the explicit calling of a destructor, the time extent of the local variable can be wrapped in an artificial block {...}:
void time()
{
{
copy c;
// ..insert code that should execute when c is still open..
}