Skip to content

Instantly share code, notes, and snippets.

@tokiwoousaka
Last active December 16, 2015 17:49
Show Gist options
  • Save tokiwoousaka/5473224 to your computer and use it in GitHub Desktop.
Save tokiwoousaka/5473224 to your computer and use it in GitHub Desktop.
Rubyのクラス何でも出来すぎだろコレ
class Foo
def hoge
print "HogeHoge\n"
end
end
F = Foo.new
F.hoge
class Foo
def piyo
print "PiyoPiyo\n"
end
end
F.piyo
class Foo
def hoge
print "Fuga\n"
end
end
F.hoge
print "-----------------------------\n"
class Bar < Foo
def huga
print "HogeraGera\n"
end
end
B = Bar.new
B.hoge
B.piyo
B.huga
print "-----------------------------\n"
class Foo
def hoge
print "HogegeHogeHoge\n"
end
end
F.hoge
B.hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment