C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - General Questions (Q.No. 37)
37.
To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .
Discussion:
2 comments Page 1 of 1.
Ridhika Agarwal said:
7 years ago
@Mayank.
The delete[] calls the destructor for every object in an array being destroyed and then calls the global array deallocation function.
Thus, unlike free, delete[] ensures that the destructor is called for every single object in an array.
The delete[] calls the destructor for every object in an array being destroyed and then calls the global array deallocation function.
Thus, unlike free, delete[] ensures that the destructor is called for every single object in an array.
Mayank said:
9 years ago
Can someone please provide an explanation ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers