Great! So far we’ve got a
Monkey class with two methods and a class variable. The class variable
@@bananas keeps track of how many bananas there are for all monkey instances, the
initialize method sets the monkey’s name when
Monkey.new is called, and
@@bananas by 1.
in's name when Monkey.new is call and eaitialize methond set the monkey's name when Monkey.new is called and eat_banana decreases @@bananas by 1.
Share this highlighthttp://www.safaribooksonline.com/a/ruby-wizardry/53595/