B
Bojan Mihelac
Hi all,
I am new to Ruby and am trying to overload "+" operator on Integer
class, without success.
class TestNum < Integer
def +(other)
self.value - other
end
end
puts TestNum.new(5)+5; # should return 0
I know that it should be simple, but.... any help appreciated.
I am new to Ruby and am trying to overload "+" operator on Integer
class, without success.
class TestNum < Integer
def +(other)
self.value - other
end
end
puts TestNum.new(5)+5; # should return 0
I know that it should be simple, but.... any help appreciated.