Skip to content

Instantly share code, notes, and snippets.

@ihower
Created March 25, 2015 12:09
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 ihower/9ffe9b86ef49d104fc12 to your computer and use it in GitHub Desktop.
Save ihower/9ffe9b86ef49d104fc12 to your computer and use it in GitHub Desktop.
ruby super
class Parent
def hi(name)
puts "I'm parent"
puts "Hi, #{name}"
end
end
class Child < Parent
def hi
puts "I'm child"
super("John")
end
end
x = Child.new
x.hi
#I'm child
#I'm parent
#Hi, John
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment