From: Joel VanderWerf Date: 2005-01-20T02:17:43+09:00 Subject: Re: Fwd: [suby-ruby] Your all time desired fundemental Ruby mod Martin DeMello wrote: > Joel VanderWerf wrote: > >>class RadioButton < Button >> # ... >> self.background = RED >>end >> >>p Button.background # ==> RED >> >>The change went up the inheritance tree. Is this what you wanted? (Maybe >>it is, and I didn't follow the discussion up to this point...) > > > That is what I wanted, but now my head hurts trying to figure out why it > works :) Isn't RadioButton a separate object from Button, and as such > shouldn't it have its own copy of all instance variables? I snipped too much... the storage for #background was a constant called BACKGROUND (or something) whose value was an array of the form [RED], so that binding would be inherited from Button to RadioButton.