Last active
June 21, 2017 15:28
-
-
Save shivabhusal/2a5146b16348be3de77221a6177889de to your computer and use it in GitHub Desktop.
What happens to existing behavior if older version object still exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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