File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes referencing outer instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "referencing outer instance" Watch "referencing outer instance" New topic
Author

referencing outer instance

Vlad Patryshev
Ranch Hand

Joined: Jun 30, 2001
Posts: 61
Say, I have
class outer {
int x;
String doStuff();
class inner {
int y;
string doInnerStuff();
}
}
Is there a way inside inner, say, in doInnerStuff(), reference not this, which will point to an instance of inner, but the this of the outer class, which would point to an instance inside which inner resides?


Thanks,<br />Vlad
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
Don't quote me on this. I have never tested it, but I think I read it somewhere. I think that 'outer.this' will work.
Vlad Patryshev
Ranch Hand

Joined: Jun 30, 2001
Posts: 61
Thanks! It works!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: referencing outer instance