i have a quick question... is there a way to obtain the reference to the
object which called the currently executing method?
here is the scenario, i have a class and a field which i would like to
populate with a reference to the object that constructed this current
object. i would attempt to accomplish this by setting the appropriate
field from within the constructor...
i figured it might be obtainable from the stack trace, but that doesn't
seem to work.
oh, and i do know that i could just add an extra parameter to the
constructor and from the calling method just pass "this", but i don't want
to have to trust that the people using my code will actually do this
correctly each time.
thanks for any input,
murat
--
Murat Tasan
mxt6@po.cwru.ed u
tasan@eecs.cwru .edu
murat.tasan@cwr u.edu
object which called the currently executing method?
here is the scenario, i have a class and a field which i would like to
populate with a reference to the object that constructed this current
object. i would attempt to accomplish this by setting the appropriate
field from within the constructor...
i figured it might be obtainable from the stack trace, but that doesn't
seem to work.
oh, and i do know that i could just add an extra parameter to the
constructor and from the calling method just pass "this", but i don't want
to have to trust that the people using my code will actually do this
correctly each time.
thanks for any input,
murat
--
Murat Tasan
mxt6@po.cwru.ed u
tasan@eecs.cwru .edu
murat.tasan@cwr u.edu
Comment