Why can't classes be used as modules?
问题 Module is the superclass of Class : Class.superclass # => Module In OOP, this implies that an instance of Class can be used in every place where an instance of Module can be used. Surprisingly, this is not the case with Class instances in Ruby: class C end c = C.new module M end # Let's do all the extend/include/prepend stuff with M! c.extend M C.include M C.prepend M # All worked fine until this line. # Let's turn to classes now! # First, get a class to work with. class C_as_M end C_as_M