[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Technical Discussion :: C++

77 / 187

How to use delete operator in destructor?

Answer:

Whenever new is used to allocate memory in the constructors. We should use delete to free that memory. For example, the destructor for the matrix class discussed above may; be defined as follows

Matrix :: ~matrix( )
{
for(int i=0;i delete p[i];
delete p;
}

Asked In ::

Post Your Answer Here:


Rate This: +0 -0     
Report    

Post Your Reply Here:

Alert me
q4i-reply-your-answer

Report Error

Please Login First Click Here

Most Popular Qs.