From: Adrian Tepes Date: 2010-11-09T18:29:08+09:00 Subject: Re: shadow copy and deep copy Eva wrote in post #960269: > Hello, > > x=[1,2,3] > y=x.dup > > this is a shadow copy, I know the theory behind it. > > z=x > > is this a deep copy? (z is the deep copy of x?) > > Thanks I don't think it's deep copy. irb(main):010:0> print z.__id__ 137429210=> nil irb(main):011:0> print x.__id__ 137429210=> nil irb(main):012:0> print y.__id__ 137515980=> nil irb(main):013:0> z.push 4 => [1, 2, 3, 4] irb(main):014:0> p x [1, 2, 3, 4] => [1, 2, 3, 4] -- Posted via http://www.ruby-forum.com/.