Created
October 8, 2018 19:48
-
-
Save electronicbites/a5aa9dc0837ca7bbe86a6cffd1e6ff1d 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 speak | |
puts "?" | |
end | |
end | |
class Cat < Animal | |
def speak | |
puts "miau" | |
end | |
end | |
class Dog < Animal | |
def speak | |
puts "wuff" | |
end | |
end | |
ant = Animal.new | |
ant.speak | |
wuffi = Dog.new | |
wuffi.speak | |
mietzi = Cat.new | |
mietzi.speak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment