From: Brian Candler Date: 2011-10-04T23:03:11+09:00 Subject: Re: Operator Overloading Darryl Pierce wrote in post #1024950: > Define a + method on your Point class: > > def +(other) > self.x += other.x > self.y += other.y > self.z += other.z > self > end Warning!! That will *mutate* the point passed as the left-hand argument of the '+'! I would suggest instead: def +(other) Point.new(x+other.x, y+other.y, z+other.z) end (Of course, 'x' and 'self.x' are the same; you can write 'self.x' if you think it's clearer) -- Posted via http://www.ruby-forum.com/.