From a method in another object, how do I access the reference to the object who called me? In other words, how do I find the object which called this object?
Chloe Loh
Greenhorn
Joined: Aug 27, 2002
Posts: 22
posted
0
I would pass the reference of the caller object into the mentioned method of the object that will be called. The declaration of the method in the class of the called object can be: e.g. void calledMethod(Object calledObject) I don't know if there is any more efficient way of doing it. but, if anyone have a better solution, I also want to learn it..
Chloe Loh
Greenhorn
Joined: Aug 27, 2002
Posts: 22
posted
0
Sorry, I made a mistake. The declaration of the method in the class of the called object can be: e.g. void calledMethod(Object callerObject)
Wilfried LAURENT
Ranch Hand
Joined: Jul 13, 2001
Posts: 269
posted
0
If you want this information for debugging purpose, you can also get it while writing this dirty code:
You will see all the stack, thus the caller . W. [ November 28, 2002: Message edited by: Wilfried LAURENT ]