Yes it was a poor choice of terminology on
my part. Each of the children are separate elements of the overall
container. As it is, both the container and element2 need an instance of
element1. I was hoping to avoid instantiating multiple instances of
element1 (one in the container, one in element2) and just combine the data and
functionality into one instance of element1. However, it looks like there
is no simple way to do that, so I am just going to change the object model so
that element2 instantiates it’s own instance of the element1 class, so
that element2 is a container for element3 which is a different instance of the
same class used in element1.
Thanks for the feedback everyone.
Regards,
From: Arnett, Matt
[mailto:Matt.Arnett@xxxxxxxxxx]
Sent: Friday, August 17, 2007 4:47
PM
To: Rich Schramm; users@xxxxxxxxxx
Subject: RE: [cinjug-users]
Calling methods of sibling objects
Sorry. I
was thinking that the children extend the parent. super won’t work
in this case. The terms parent/child threw me off a little J
From: Arnett, Matt
Sent: Friday, August 17, 2007 3:19
PM
To: 'Rich Schramm';
users@xxxxxxxxxx
Subject: RE: [cinjug-users]
Calling methods of sibling objects
http://www.faqs.org/docs/javap/c5/s5.html
super.child1.method1();
From: Rich Schramm
[mailto:richard.schramm@xxxxxxxxxxxxxxxxxx]
Sent: Friday, August 17, 2007 3:01
PM
To: users@xxxxxxxxxx
Subject: [cinjug-users] Calling
methods of sibling objects
Hi,
Hoping this is not a dumb question, maybe someone call help.
The object model for my application contains a parent object
(Parent) that has two other objects as properties (child1 and child2). In
child1, there is a method (method1) that I want to call from child2.
However, I am stumped on how to get a handle to child1 or even the parent from
within child2 without having to pass a reference to child2 from a method in
parent. Is there a way to call parent.child1.method1() from within
parent.child2?
Thanks,
Richard Schramm
Supply Dynamics, LLC.
513.965.2000 x14 (office)
513.300.7851 (mobile)
http://www.supplydynamics.com/
This e-mail transmission contains information that is intended to be
confidential and privileged. If you receive this e-mail and you are not a named
addressee you are hereby notified that you are not authorized to read, print,
retain, copy or disseminate this communication without the consent of the
sender and that doing so is prohibited and may be unlawful. Please reply to the
message immediately by informing the sender that the message was misdirected.
After replying, please delete and otherwise erase it and any attachments from
your computer system. Your assistance in correcting this error is appreciated.
_____________________________________________________________________________
Scanned by IBM Email Security Management Services powered by MessageLabs. For
more information please visit http://www.ers.ibm.com
_____________________________________________________________________________