Created
December 3, 2013 19:06
-
-
Save jmoon90/7775502 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 | |
| attr_reader :name | |
| def initialize | |
| end | |
| def sound | |
| "ajclvkja" | |
| end | |
| def emote | |
| puts "The #{self.class} makes the sound #{sound}" | |
| end | |
| end | |
| class Duck < Animal | |
| def sound | |
| puts "quack" | |
| end | |
| end | |
| class Cat < Animal | |
| def sound | |
| puts "meow" | |
| end | |
| end | |
| class Dog < Animal | |
| def sound | |
| puts "woof woof" | |
| end | |
| end | |
| new_duck = Duck.new | |
| new_duck.emote | |
| new_dog = Dog.new | |
| new_dog.emote | |
| new_cat = Cat.new | |
| new_cat.emote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment