1.

What is the scope of local class?(a) Within the class only(b) Within the function(c) Within the program(d) One time creation and live till end of programThe question was posed to me in an international level competition.I need to ask this question from Local Class in division Class Members & Types of Object Oriented Programming

Answer»

Correct CHOICE is (b) WITHIN the function

To explain I would say: The SCOPE of a local class is limited only within the function definition. The function can use the class as usual as local VARIABLES. The class gets destroyed as soon as the function is returned.



Discussion

No Comment Found

Related InterviewSolutions