From: Bill Kelly Date: 2004-02-09T12:47:33+09:00 Subject: Re: Newbie question Hi, From: "Stephen Taylor" > [...] > > class Money > attr_accessor :value > def to_s > '�' + @value.to_s > end > end > > permits: > > m = Money.new > m.value= 1234 > puts m.to_s > "�1234" > > Question: can we create and set in one move? We imagine > > n = Money.new(1234) > > But if we: > > def Method.new(amt) > initialize > @value = amt > end Is Method.new a typo for Money.new? But instead, try defining an initialize method, rather than new, like: class Money def initialize(amt) @value = amt end end Then: n = Money.new(1234) should do what you wanted.. Hope this helps, Bill