1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# «program» class Cat def speak() puts "meow" end end class Cow def speak() puts "moo" end def num_stomachs() 4 end end def hear_what_it_has_to_say(obj) obj.speak end hear_what_it_has_to_say(Cat.new) hear_what_it_has_to_say(Cow.new) # «end»