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 arisesThe question was asked during a job interview.Question is from Local Class in division Class Members & Types of Object Oriented Programming

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