Tuesday, 17 April 2012

On throwing an exception by the Animal constructor in p = new AnimalQ, can memory leak occur? | C++

Memory of an animal class cannot leak by throwing an exception in p = new Animal(). In case of occurrence of an exception during the Animal constructor of p = new Animal(),there is a surety of the automatic releasing of the allocated memory back to the heap.

No comments: