初学ruby 在看到ruby的<=>这个运算符的调用上有些疑惑,希望各位能解答一下 class Person def initialize(name,age) @name = name @age = age end def <=>(other) self.age <=> other.age end end test1 = Person.new("test1", 20) test2 = Person.new("test2", 18) test1.<=>(test2) 上面的<=>应该是定义 ...
darkhucx
  • 浏览: 12831 次
  • 性别: Icon_minigender_1
  • 来自: 宁夏银川
  • 详细资料
搜索本博客
我的相册
22a41ef8-e718-43bc-a16e-da7d6daa1200-thumb
rails工作原理
共 1 张
最近加入圈子
最新评论
评论排行榜