Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. class Dog < Animal
  2. attr_reader :weight
  3.  
  4. def initialize(name, weight)
  5. super(name)
  6. @weight = weight
  7. end
  8. end
  9.  
  10. fluffy = Dog.new('Fluffy', '5 lbs')
  11. puts fluffy.name # => 'Fluffy'
  12. puts fluffy.weight # => '5 lbs'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement