Last active
August 11, 2017 10:09
-
-
Save asvetly/224c0e1ad3eb96783ff52c87c1ce59c6 to your computer and use it in GitHub Desktop.
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
class Animal | |
def talk | |
'' | |
end | |
end | |
class Dog < Animal | |
def talk | |
'bork' | |
end | |
end | |
class Cat < Animal | |
def talk | |
'meow' | |
end | |
end | |
def animal_info(animal) | |
"This is #{animal.class.name} and it says #{animal.talk.upcase}" | |
end | |
animal_info(Dog.new) | |
animal_info(Cat.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment