From: Jim Freeze Date: 2001-10-03T22:45:08+09:00 Subject: [ruby-talk:21999] Class const in a super class Hi: I am trying to define a constant in a superclass, but use that const in the base class. So far, no luck. Here is an example of what I am trying to do: class Base def initialize puts "classconst: #{CLASSCONST}" end end class A1 < Base CLASSCONST = "a1" end class A2 < Base CLASSCONST = "a2" end A1.new A2.new When I run this I get the error: ./test.rb:5:in `initialize': uninitialized constant Base::CLASSCONST (NameError) from ./test.rb:16:in `new' from ./test.rb:16 Any ideas how I can accomplish this? Thanks ========================================================= Jim Freeze jim@freeze.org --------------------------------------------------------- No comment at this time. http://www.freeze.org =========================================================