From: Daniel Carrera Date: 2003-01-22T07:36:31+09:00 Subject: Re: Overloading operators On Wed, Jan 22, 2003 at 07:29:33AM +0900, Dmitri Colebatch wrote: > I was also wondering if there is a way to implement += > > total = Amount.aud(300) > total += Amount.aud(500) > > total -> AUD 800 If you reimplement "+", "+=" is reimplemented as well: >> class Fixnum >> def +(other) >> return 5 >> end >> end => nil >> 1 + 1 => 5 >> var = 1 => 1 >> var += 1 => 5 Cheers, -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137