我有一个大致是这样的课程:
class C
attr_accessor :board # board is a multidimensional array (represents a matrix)
def initialize
@board = ... # initialize board
end
def ==(other)
@board == other.board
end
end
不过,当我这样做时:
s = Set.new
s.add(C.new)
s.include?(C.new) # => false
为什么?