Ruby - Operators and Expressions
What will be the output of this Ruby code?
class Box
attr_reader :value
def initialize(value)
@value = value
end
def +(other)
Box.new(@value + other.value)
end
end
box1 = Box.new(5)
box2 = Box.new(10)
result = box1 + box2
puts result.value