1.

Which cases among the following produces the undefined result?(a) delete [] on an independent object(b) delete on an object array(c) delete [] on an object and delete on object array(d) Undefined result is never producedThe question was posed to me in examination.This key question is from Delete Operator topic in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Right answer is (c) DELETE [] on an object and delete on object ARRAY

Explanation: The UNDEFINED result is always produced when we try to use delete [] with a single object. Because the type of deletion mismatches. Same in CASE where we try to apply delete to an object array.



Discussion

No Comment Found

Related InterviewSolutions