Mega Code Archive

 
Categories / Ruby / Class
 

Creating an Object

# You use the new method to create an object in Ruby. class Animal   def initialize     @color = "red"   end   def get_color     return @color   end end animal = Animal.new