If a local class is defined in a function, which of the following is true for an object of that class?

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 function
 
Answer: d
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.
 

Tìm kiếm

Back
Top