Ruby - Operators and Expressions
What is the issue with this Ruby code?
class Coordinate
attr_reader :x, :y
def initialize(x, y)
@x, @y = x, y
end
def +(other)
Coordinate.new(@x + other.x, @y + other.y)
end
end
c1 = Coordinate.new(2, 3)
c2 = Coordinate.new(4, 5)
puts c1 + c2