即在Ruby中可以执行以下操作:
class A def met1 end def met2 met1 #call to prevIoUsly defined method1 end end
谢谢,
RM
class A def met1 puts "In met1" end def met2 met1 end end var1 = A.new var1.met2
这是等效的使用类方法,您通过使用其类名称将方法的名称前缀来创建:
class A def A.met1 puts "In met1" end def A.met2 met1 end end A.met2