Skip to content

Instantly share code, notes, and snippets.

@at-longhoang
Created March 9, 2016 09:47
Show Gist options
  • Save at-longhoang/96eb3c2a4676195e6cb4 to your computer and use it in GitHub Desktop.
Save at-longhoang/96eb3c2a4676195e6cb4 to your computer and use it in GitHub Desktop.
# class Parent
# def knox
# puts 'parent'
# end
# end
# class Child < Parent
# def knox
# puts 'child'
# end
# end
# ch = Child.new
# ch.knox
class Parent
def knox
puts 'parent'
end
end
class Child < Parent
alias_method :parent_knox, :knox
def knox
puts 'child'
end
end
ch = Child.new
ch.parent_knox
ch.knox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment