Last active
December 30, 2015 03:59
-
-
Save sdanko11/7772597 to your computer and use it in GitHub Desktop.
Animals Classes
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 :animal_name | |
| def initialize(name) | |
| @animal_name = (name) | |
| end | |
| def eat(what_they_eat) | |
| puts "just ate #{what_they_eat}" | |
| end | |
| end | |
| class Dog < Animal | |
| attr_reader :bark | |
| def bark | |
| "ruff ruff" | |
| end | |
| end | |
| class Duck < Animal | |
| attr_reader :quak | |
| def quack | |
| puts 'quack quack' | |
| end | |
| end | |
| class Cat < Animal | |
| attr_reader :meow | |
| def meow | |
| puts 'meow' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment