| Author |
Getting the reference to an Enclosing Object from a reference to a object inside it.
|
N Naveen
Greenhorn
Joined: Sep 04, 2003
Posts: 27
|
|
Hi, I have the following requirement. Thanks in advance, Naveen N
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24041
|
|
|
No, it's not possible, except by changing the method signature of method1 so you can pass it in as an argument.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Andris Jekabsons
Ranch Hand
Joined: Jan 20, 2004
Posts: 82
|
|
I agree that it is best to modify method1() signature, but isn't it possible to add a static variable "X dummy" to the ABC class and then reference it from the method1()? Sure it would be shared by all ABC objects, but that's ok, because it is already shared, since main() is static, too. Here is a modified code:
|
 |
N Naveen
Greenhorn
Joined: Sep 04, 2003
Posts: 27
|
|
I dont wish to change it to a static variable. Though the main method is static,the variable is still a local variable. Thanks a lot for replying. I guess its not possible.
|
 |
 |
|
|
subject: Getting the reference to an Enclosing Object from a reference to a object inside it.
|
|
|