Created
December 3, 2013 19:13
-
-
Save vanmichael/7775684 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 initialize(name) | |
@name = name | |
end | |
def emote | |
"#{@name} " | |
end | |
def eat | |
"#{@name} eats " | |
end | |
end | |
class Duck < Animal | |
def emote | |
super + "quacks!" | |
end | |
def eat | |
super + "corn!" | |
end | |
end | |
class Cat < Animal | |
def emote | |
super + "meows!" | |
end | |
def eat | |
super + "mice!" | |
end | |
end | |
class Dog < Animal | |
def emote | |
super + "barks!" | |
end | |
def eat | |
super + "dogfood!" | |
end | |
end | |
require 'pry' | |
binding.pry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment