SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Dog
  2.   attr_accessor :breed, :color
  3.  
  4.   def initialize(breed, color)
  5.     @breed = breed
  6.     @color = color
  7.   end
  8.  
  9.   def kind_of_pet
  10.     puts "Dogs are very loving pets!"
  11.   end
  12. end
  13.  
  14. class Poodle < Dog
  15.   def fur
  16.     puts "Poodles are very fluffy!"
  17.   end
  18. end
  19.  
  20. class Puggle < Poodle
  21.   def mixed
  22.     puts "A Puggle is half poodle, half pug."
  23.   end
  24. end
  25.  
  26. dog = Dog.new('Boxer', 'White')
  27. dog.kind_of_pet
  28.  
  29. poodle = Poodle.new('Poodle', 'Black')
  30. poodle.fur
  31.  
  32. puggle = Puggle.new('Puggle', 'Brown')
  33. puggle.mixed
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top