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:
class Top
def initialize(a)
Middle.new(a)
end
end
class Middle
def initialize(a)
Bottom.new(a)
end
end
class Bottom
def initialize(a)
puts a
end
end
A.new("Thanks! I need that.")
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?
--
~transami
"They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin