ruby 代码 class A def meth pust "old method involked!" s = <<-EOF def meth puts "new method involked!" end EOF self.instance_eval(s) end end a = A.new a.meth =>"old method involded" a.meth =>"new method involded" 多态原来也可以这样做