Skip to content

Instantly share code, notes, and snippets.

@syusui-s
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syusui-s/9478949 to your computer and use it in GitHub Desktop.
Save syusui-s/9478949 to your computer and use it in GitHub Desktop.
class Base
CONSTANT = 1
def initialize
puts CONSTANT
end
def puts_constant_base
puts CONSTANT
end
end
class Derived < Base
CONSTANT = 2
def puts_constant_derived
puts CONSTANT
end
end
puts "new base"
base = Base.new
puts "new derived"
derived = Derived.new
puts "base puts_constant_base"
base.puts_constant_base
puts "derived puts_constant_base"
derived.puts_constant_base
puts "derived puts_constant_derived"
derived.puts_constant_derived
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment