Forked from anonymous/gist:b71b70034bfde2a5929d5d40a52d371b
Last active
June 20, 2016 13:39
-
-
Save esse/ad37a48a9ffd4770c306a1d1a14e2e5d 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 | |
attr_accessor :name | |
attr_accessor :age | |
attr_accessor :sex | |
def initialize(name, sex, age) | |
@name = name | |
@sex = sex | |
@age = age | |
@hunger_level = rand(10) | |
end | |
end | |
class Lion < Animal | |
#hunger_level = rand(10) | |
end | |
class Tiger < Animal | |
#hunger_level = rand(10) | |
end | |
class Monkey < Animal | |
#hunger_level = rand(10) | |
end | |
class Zoo | |
def initialize | |
@animals_in_zoo = [] | |
end | |
def add_animal(name) | |
if @animals_in_zoo.include?(name) | |
"THE SAME ANIMAL - ERROR!" | |
else | |
@animals_in_zoo.push(name) | |
end | |
end | |
def feed_animal | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment