Skip to content

Instantly share code, notes, and snippets.

@vanmichael
Created December 3, 2013 19:13
Show Gist options
  • Save vanmichael/7775684 to your computer and use it in GitHub Desktop.
Save vanmichael/7775684 to your computer and use it in GitHub Desktop.
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