InterviewSolution
Saved Bookmarks
| 1. |
If a local class is defined in a function, which of the following is true for an object of that class?(a) Object is accessible outside the function(b) Object can be declared inside any other function(c) Object can be used to call other class members(d) Object can be used/accessed/declared locally in that functionThis question was addressed to me in examination.This interesting question is from Objects in section OOPs Concept & Features of Object Oriented Programming |
|
Answer» RIGHT option is (d) Object can be used/accessed/declared locally in that function Explanation: For an object which belongs to a LOCAL class, it is MANDATORY to DECLARE and use the object WITHIN the function because the class is accessible locally within the class only. |
|