What is needed to ensure that inner classes reference members properly?
0 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Tuesday, June 19, 2001 07:23 AM

I thought that an inner class would reference all the members correctly, but it sees some of them as null when they are already initialized/assigned.

I tried these as work-arounds, and they worked fine:

  • making members final,

  • initializing members at declaration (outside the constructor).

My question is - what do I really have to do to ensure proper referencing to the outer class' members from inner classes' methods? I thought any member would be accessible from an inner class, which apparently isn't the case.

About | Sitemap | Contact