From: Joel VanderWerf Date: 2003-05-11T13:10:31+09:00 Subject: Re: Overriding class variables Ryan Pavlik wrote: > On Sun, 11 May 2003 11:30:22 +0900 > elbows@spamcop.net (Nathan Weston) wrote: > > >>In ruby 1.6.8, overriding class variables cause weird (to me at least) >>results: >> >>class Foo >> Const = 0 >> > > > > That's not a class variable. You want @@const or something... although > a class variable isn't a const. OTOH, you're changing it, so you don't > want a const, either. ;-) > > Use @@var. It acts like you want. Does it? class Foo @@Const = 0 def c @@Const end end class Bar < Foo @@Const = 1 end print Bar.new.c # ==> 1 print Foo.new.c # ==> 1 That may or may not be what the OP wanted.