Guest User

Untitled

a guest
Jul 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. class Dog
  2. def initialize(bark, fur, color, style = "domesticated")
  3. @bark = bark
  4. @fur = fur
  5. @color = color
  6. @style = style
  7. end
  8. def describe
  9. puts "I am #{@color} and I have #{@fur} fur. I am #{@style}"
  10. end
  11. def speak
  12. puts @bark
  13. end
  14. def growl
  15. puts "#{@bark}!!!!"
  16. end
  17. end
  18.  
  19. fido = Dog.new("bow-wow", "short", "brown")
  20. spot = Dog.new("arf", "long", "white", "wild")
  21.  
  22. fido.speak
  23. fido.describe
  24. spot.speak
  25. spot.describe
  26. fido.growl
  27.  
  28. class Cat
  29. def what_time_is_it
  30. puts Time.now
  31. end
  32. end
  33.  
  34. Cat.what_time_is_it
Add Comment
Please, Sign In to add comment