From: "Jesús Gabriel y Galán" Date: 2008-04-15T20:19:23+09:00 Subject: Re: How to duplicate a object changing the class without attributes memory copy On Tue, Apr 15, 2008 at 10:26 AM, Iñaki Baz Castillo wrote: > 2008/4/15, Gennady Bystritsky : > > > Not true. To verify it, after you do "from.name = header.name", try this: > > > > puts header.name.object_id > > puts from.name.object_id > > > > You will see same object id, meaning that you have a reference, not a new object. > > Ohh, that's annoying for me! > You are right, both are the same objects **until** I modify one of them. I mean: This sentence is confusing: you don't modify one of them, you assign the variable a different object: a = "header" b = a a --------> "header" ^ | | b b = "new header" a --------> "header" b --------> "new header" The object previously referenced by both a and b has not been modified. When you assigned a new string to b, then b referenced a different object. Jesus.