Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dog
- def initialize(bark, fur, color, style = "domesticated")
- @bark = bark
- @fur = fur
- @color = color
- @style = style
- end
- def describe
- puts "I am #{@color} and I have #{@fur} fur. I am #{@style}"
- end
- def speak
- puts @bark
- end
- def growl
- puts "#{@bark}!!!!"
- end
- end
- fido = Dog.new("bow-wow", "short", "brown")
- spot = Dog.new("arf", "long", "white", "wild")
- fido.speak
- fido.describe
- spot.speak
- spot.describe
- fido.growl
- class Cat
- def what_time_is_it
- puts Time.now
- end
- end
- Cat.what_time_is_it
Add Comment
Please, Sign In to add comment