Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. class Car
  2. attr_reader :num_of_tires
  3. attr_accessor :miles_per_hour, :color
  4.  
  5. def initialize(color)
  6. @color = color
  7. @num_of_tires = 4
  8. end
  9.  
  10. def drive(miles_per_hour)
  11. p "This car can drive #{miles_per_hour} mph!"
  12. end
  13.  
  14. end
  15.  
  16. honda = Car.new("red")
  17. honda.color
  18. honda.num_of_tires
  19. honda.miles_per_hour = 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement