1.

Can two different functions have local class with same name?(a) Yes, since local(b) No, names must be different(c) No, scope doesn’t work here(d) No, ambiguity arises

Answer» The correct answer is (a) Yes, since local

For explanation: The local classes can have same name if they belong to different functions. The classes would be local to those specific functions and hence can have same name. This is same as that of local variables concept.


Discussion

No Comment Found

Related InterviewSolutions