Skip to content

Instantly share code, notes, and snippets.

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 shivabhusal/2a5146b16348be3de77221a6177889de to your computer and use it in GitHub Desktop.
Save shivabhusal/2a5146b16348be3de77221a6177889de to your computer and use it in GitHub Desktop.
What happens to existing behavior if older version object still exists
# What happens to existing behavior if older version object still exists
class MyClass
def print
puts 'This is still old behavior'
end
end
old_class = MyClass.new
# Modifying the original blue print or prototype
class MyClass
def print
puts 'Modified behavior'
end
end
new_class = MyClass.new
old_class.print
# => Modified behavior
new_class.print
# => Modified behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment