Last active
August 29, 2015 13:57
-
-
Save syusui-s/9478949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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