Results 1 to 3 of 3
- 04-04-2010, 11:05 AM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Find instance that owns instance?
Hai!
I just wanted to know if you could, in some way, find that instance that have a varibale of another instance.
For example:
I have two classes, class_1 and class_2.
class_1 have a variable named "class_2 foo;"
foo is assigned to be = new class_2();
Then I find the instance class_2, and I want to ask:
Who have this instance of class_2 as a variable?
Is it possible to find that out?
- 04-04-2010, 11:41 AM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
It is possible, but as a rule, it's really not what you want to do. If you're in a spot where you think you want to do that, you probably have problems with your overall design. But if you really want to do it, study about Reflection, and examining stack traces from within code.
-Gary-
- 04-04-2010, 03:36 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Similar Threads
-
instance fields?
By search4survival in forum New To JavaReplies: 3Last Post: 04-03-2010, 05:10 PM -
Using an Instance method
By Thumper in forum New To JavaReplies: 4Last Post: 12-09-2009, 06:43 PM -
instance access
By sujaiyer85 in forum Advanced JavaReplies: 2Last Post: 04-23-2008, 07:37 AM -
New Instance for SWT
By srinivasa_v in forum SWT / JFaceReplies: 1Last Post: 08-08-2007, 01:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks