users
[Top] [All Lists]

RE: [cinjug-users] Calling methods of sibling objects

To: <users@xxxxxxxxxx>
Subject: RE: [cinjug-users] Calling methods of sibling objects
From: "Scott T Weaver" <sweaver@xxxxxxxxxxxxxxx>
Date: Fri, 17 Aug 2007 15:23:01 -0400
Delivered-to: mailing list users@xxxxxxxxxx
In-reply-to: <BCDB7761EF65A54B92F46CD400D1D2D96330F5@xxxxxxxxxxxxx>
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
Thread-index: AcfhAOSU3Fd7p534QcOSzFBghwSxDgAAoljw

Off the top of my, I would suggest the Visitor pattern (http://en.wikipedia.org/wiki/Visitor_pattern).  Make child2 a visitor for Parent’s children then it can act on child1.

 

-scott

 


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/

 

<Prev in Thread] Current Thread [Next in Thread>