1.

For declaring data by using new operator ____________________(a) Type name can’t contain const(b) Type name can’t contain volatile(c) Type name can’t contain class declarations(d) Type name can’t contain const, volatile, class declaration or enumerationsThis question was addressed to me in class test.I need to ask this question from New Operator in division Memory Allocation & Scope of Variable of Object Oriented Programming

Answer»

Right OPTION is (d) Type name can’t contain CONST, volatile, class declaration or enumerations

To explain: The declaration of any data where we use new operator, any of the mentioned types are not ALLOWED. This is because the new operator allocated MEMORY BASED on the type of data which can be allocated dynamically.



Discussion

No Comment Found

Related InterviewSolutions