This was a qustion on a mock quiz: How is an instance of Outer accessed from within an instance of inner within non static classes? The answer was: Outer.this Can someone write some short code depicting this? I have been trying and can't seem to do it. Thanks so much. Rick
posted 18 years ago
Ok, I found the answer in Khalid & Mughal's book. Weird, I would have never thought to use 'this' like that since I've always just seen inner classes refer to the outer class members directly.
What threw me off was the phrasing of the question and I'm still not sure it was phrased correctly. I was thinking of somehow getting a handle to an instance variable of the outer class with OuterClassName.this but in the above that's not really what I'm doing.