given this code:
class A CONST = 'A' def initialize puts CONST end end class B < A CONST = 'B' end A.new # => 'A' B.new # => 'A'
I'd like B to use the CONST = 'B' definition, but I don't know how. Any ideas?
B
CONST = 'B'
Greetings
Tom
class A CONST = 'A' def initialize puts self.class::CONST end end class B < A CONST = 'B' end A.new # => 'A' B.new # => 'B'
2.1m questions
2.1m answers
60 comments
57.0k users