ruby入门_没有重载方法

来源:互联网 发布:药学知乎 编辑:程序博客网 时间:2024/06/10 21:14

ruby没有重载方法

class Person  def says    puts "there is no overload in ruby!"  end    def says(word)    puts word  endendperson = Person.new# here is wrong# person.saysperson.says("hey!")

使用
person.says将报错

原创粉丝点击