From: Martin DeMello Date: 2005-01-19T14:26:03+09:00 Subject: Re: Fwd: [suby-ruby] Your all time desired fundemental Ruby mod "trans. (T. Onoma)" wrote: > | > class Button > | > class < self > | > def background > | > @background ||= BLUE > | > end > | > end > | > > | > def repaint > | > @background = self.class.background > | > ... > | > end > | > end > | > > | > class ImageButton < Button > | > end > | > > | > That's the idea. Work for you? > | > | No, becaus the idea is that ImageButton will *not* inherit @background > | from Button, it being a separate object. > > You want it not to inherit? No, I want it to inherit, and I specifically want both Class.@background variables to point to the same object at all times. Possible with @@variables (though I'd forgotten about the order-of-creation effect Joel pointed out, so I'm indeed better off using a SuperHash). martin