No, it cannot. The definition of a local variable is that its life is determined by the scope of its declaration. But you can limit the scope if you want.

Qt Code:
  1. Cat *tofi = new Cat();
  2. {
  3. Cat smuki;
  4.  
  5. delete tofi; //object on the heap deleted ok
  6. } // smuki undeclared past this point
To copy to clipboard, switch view to plain text mode