G
Gavin Kistner
Is there a clean, good, easy way to do the following:
class Human; end
class Male < Human
def laugh
puts "Yo ho ho"
end
end
class Female < Human
def laugh
puts "Tee hee"
end
end
module Yokel
#...special code here...
end
class Human
include Yokel
end
m = Male.new
m.laugh
#=> "Slapping my knee"
#=> "Yo ho ho"
#=> "Snorting"
f = Female.new
f.laugh
#=> "Slapping my knee"
#=> "Tee hee"
#=> "Snorting"
class Human; end
class Male < Human
def laugh
puts "Yo ho ho"
end
end
class Female < Human
def laugh
puts "Tee hee"
end
end
module Yokel
#...special code here...
end
class Human
include Yokel
end
m = Male.new
m.laugh
#=> "Slapping my knee"
#=> "Yo ho ho"
#=> "Snorting"
f = Female.new
f.laugh
#=> "Slapping my knee"
#=> "Tee hee"
#=> "Snorting"