Skip to content

Instantly share code, notes, and snippets.

@napcs
Created April 20, 2010 19:06
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 napcs/372906 to your computer and use it in GitHub Desktop.
Save napcs/372906 to your computer and use it in GitHub Desktop.
class Person
def say_hello
"Hello"
end
end
class Person
def say_goodbye
"goodbye"
end
end
p = Person.new
puts p.say_hello
puts p.say_goodbye
class Person
def say_goodnight
"goodnight"
end
end
puts p.say_goodnight
p2 = Person.new
class << p2
def say_hello
"Hi there!"
end
end
puts p2.say_hello
puts p.say_hello
p3 = Person.new
def p3.say_hello
"Hola!"
end
puts p3.say_hello
puts p2.say_hello
puts p.say_hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment