From: Lex Williams Date: 2008-08-28T14:48:37+09:00 Subject: Re: how to avoid passing by reference and how to copy objects > create some NEW pointers but which point to the same memory space. If i > edit one of the members it will be reflected in both a and b. However if > i substitute it for a totally different member im guessing new memory > space is allocated and a pointer points to that new memory space. Hence > the change is reflected in only one array. > > to get a copy where new memory space for duplicate objects is creted, > you look towards marshall.. > > am i right (roughly) ... hmmm pointers in C was always tricky. Here is a little example class XTest attr_accessor :test def initialize @test = 2 end end first = XTest.new first.test = 10 second = first.clone second.test = 11 puts first.test So , If you want to preserve your parameters , clone them. -- Posted via http://www.ruby-forum.com/.