From: Matt Armstrong Date: 2002-12-17T06:51:13+09:00 Subject: Re: Deep copy in Rub? christopher.j.meisenzahl@citicorp.com writes: > I remember when using C++ for the first time and running into the > shallow/deep copy problem. "I copied my object, freed something in > obj_b, but it's also gone in obj_a, what gives!?!" :-) In addition to the other answers, there are two methods to copy an object in Ruby. Object.dup and Object.clone. I'm not sure why -- they don't do anything different in the standard classes. The Pickaxe book says they might do something different in derived classes, but stops short of suggesting a practice (e.g. clone does deep copy and dup does shallow copy).