-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattribute.rb
57 lines (41 loc) · 962 Bytes
/
attribute.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class Feline
attr_accessor:cat_name
end
class Cat < Feline
def meow
return "MEOOOOOWWWWWWWWW"
end
end
class Tiger < Feline
def roar
return "ROOOOOAAAAARRRR"
end
end
class Bobcat < Feline
def meep
return "MEEP MEEP"
end
end
class Lion < Feline
def growl
return "GRRRRRRRRRR"
end
end
kitty_cat = Cat.new
kitty_cat.cat_name="Dr. Prrrrr"
kittyname=kitty_cat.cat_name
big_kitty_1=Tiger.new
big_kitty_1.cat_name="Tony"
tigername=big_kitty_1.cat_name
big_kitty_2=Bobcat.new
big_kitty_2.cat_name="Bob"
bobcatname=big_kitty_2.cat_name
big_kitty_3=Lion.new
big_kitty_3.cat_name="Leo"
lionname=big_kitty_3.cat_name
puts "#{kittyname} says #{kitty_cat.meow}, #{tigername} says #{big_kitty_1.roar}, #{bobcatname} says #{big_kitty_2.meep}, and #{lionname} says #{big_kitty_3.growl}."
puts kitty_cat.inspect
puts big_kitty_1.inspect
puts big_kitty_2.inspect
puts big_kitty_3.inspect
#