From: Albert Wagner Date: 2002-07-07T08:37:32+09:00 Subject: Re: passing to objects at the bottom On Saturday 06 July 2002 06:11 pm, Tom Sawyer wrote: > i have a chain of objects such that one object contains another which > contains another, and so on, down the line. the top object recieves a > parameter which only the bottom most object in the chain is going to > need. but how do i get it down there with out passing it through all the > rest? and not using a global variable? for example: > > how do i get a to Bottom without going through Middle, since Middle > dosen't really need a. of course in my real program, i have about 4 > middles. does anyone have any better solutions to this problem? I think the real answer would require more detail about what Top, Middle and Bottom are modeling. Alan's answer would work for this example. Also, refactoring so that Bottom is a subclass of Top that shares Top's accessors. It's hard to say without more info.