From: David Heinemeier Hansson Date: 2004-01-25T20:11:09+09:00 Subject: Constant inheritance Is there anyway to let a subclass overwrite a constant in the superclass? As in getting B.new.X in the example below to return 0. If not are there any similar constructions that would do something comparable? (short of converting the constant to a method). irb(main):001:0> class A irb(main):002:1> X = 0 irb(main):003:1> def X irb(main):004:2> X irb(main):005:2> end irb(main):006:1> end => nil irb(main):007:0> A.new.X => 0 irb(main):008:0> class B < A irb(main):009:1> X = 10 irb(main):010:1> end => 10 irb(main):011:0> B.new.X => 0 -- David Heinemeier Hansson. http://www.loudthinking.com/ -- Broadcasting Brain