From: "Darryl L. Pierce" Date: 2011-10-04T22:16:54+09:00 Subject: Re: Operator Overloading On 10/04/2011 01:23 AM, Hans Mackowiak wrote: > class Point > def +(other) > #there your code, i think > result = Point.new > result.x = self.x + other.x > result.y = self.y + other.y > result.z = self.z + other.z > return result > end > end > > but you also need to make the variables accessable like > class Point > attr_accessor :x,:y,:z > end And add '@' to them in the constructor. > > and you should remove your init, it is wrong > -- Darryl L. Pierce http://mcpierce.multiply.com/ "What do you care what people think, Mr. Feynman?"