module Temp def initialize p "asdasd" end end class Swap include Temp def initialize p "m in class" end end s = Swap.new
m in class
除非您使用super显式调用它们,否则不会调用重写的方法.例如
class Swap include Temp def initialize p "m in class" super end end
将从Swap#initialize调用Temp#initialize.