From: Jim Weirich Date: 2006-05-24T05:31:04+09:00 Subject: Re: Anobject question narizona wrote: > > In prag ruby the purchased copy, the following code fragment is shown. > Look at where I added the >>>>. That line VU.new(@volume.succ). What I > think it should do is create a new object instance of the class. What > it does though is it increments the attribute @volume on an existing > object that uses the succ method. > > I have verified that it does not create a new object by using > myObject.object_id. Try running the code like this ... v = VU.new(0) v2 = v.succ p v.volume, v.object_id p v2.volume, v2.object_id Does that do what you expect? -- Jim Weirich -- Posted via http://www.ruby-forum.com/.