1.

If new throws an error, which function can be called to write a custom exception handler?(a) _set_handler(b) _new_handler(c) _handler_setter(d) _set_new_handlerI have been asked this question in an internship interview.This key question is from New Operator topic in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Correct option is (d) _set_new_handler

Explanation: If the default exception handler has to be replaced by a USER defined handler, we can call _set_new_handler run-time library function with the function name as an ARGUMENT. This lets the programmer to GIVE a custom definition for handling new OPERATOR failure.



Discussion

No Comment Found

Related InterviewSolutions