P
Pokkai Dokkai
suppose a object (obj1) have another object (obj2) itself.
how to find obj1.object_id inside obj2 ?
how to find obj1.object_id inside obj2 ?
2008/2/18 said:suppose a object (obj1) have another object (obj2) itself.
how to find obj1.object_id inside obj2 ?
ThoML said:Well, I'm not sure if I understood the question right. But I think
something like this is possible (struct maybe is a bad choice for
demonstration purposes):
class A
def initialize(o=nil)
@o = o
end
end
Anyway, the proper way probably would be to design the class so that
obj2 gets a reference to obj1 when it is included in obj1 (if you know
it needs such a reference), which is what Robert meant I suppose.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.