1.

Which among the following is true?(a) New operator can’t allocate functions but pointer to functions can be allocated(b) New operator can allocate functions as well as pointer to functions(c) New operator can allocate any type of functions(d) New operator is not applicable with functions allocationI got this question during an interview.My question comes from New Operator in chapter Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

The correct option is (a) NEW OPERATOR can’t allocate functions but pointer to functions can be allocated

Explanation: The new operator can’t allocate functions but can allocate pointer to the functions. This is a security feature as WELL as to REDUCE the ambiguity in CODE. The new keyword is not given functionality to directly allocate any function.



Discussion

No Comment Found

Related InterviewSolutions