Ruby 提供了不用实例化即可访问方法的方式。方法如下:
class ClassName
def reading_charge
end
def ClassName.hello
return "hello"
end
end
其中hello 调用方法如下所示:
ClassName.hello
Ruby 提供了不用实例化即可访问方法的方式。方法如下:
class ClassName
def reading_charge
end
def ClassName.hello
return "hello"
end
end
其中hello 调用方法如下所示:
ClassName.hello