0
private nested classes - arrays and accessing
if you declare a nested class as private, does it get treated like a private variable in the container class? Also, can you create an array of a nested class?
1 Resposta
0
Language?
Usually a private nested class is accessible only from its container class. There are few exceptions to this depending on the language. The nested class will have access to all the containing classes variables and methods in the same way the a method within the containing class would. All that being said you still typically treat the class in the containing class as any other class. You Still need to create a new instance of it or use it's static methods utilizing the the Class.method() syntax.