Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dog < Animal
- attr_reader :weight
- def initialize(name, weight)
- super(name)
- @weight = weight
- end
- end
- fluffy = Dog.new('Fluffy', '5 lbs')
- puts fluffy.name # => 'Fluffy'
- puts fluffy.weight # => '5 lbs'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement