Created
June 20, 2016 13:36
-
-
Save anonymous/b71b70034bfde2a5929d5d40a52d371b 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 | |
@animals = [] | |
def initialize(name, sex, age) | |
@name = name | |
@sex = sex | |
@age = age | |
@hunger_level = rand(10) | |
"THE SAME ANIMAL - ERROR!" if @animals.include?(@name) | |
end | |
p @animals | |
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 | |
@animals_in_zoo = [] | |
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