March 19, 2011 · 2 min read
We have seen earlier, shallow copying is easier and deep copying takes more time, especially, when properties (variables) are many. Here comes another way of copying, **cloning**. In cloning, object to object is assigned, but at the same time encapsulation is maintained. Both objects occupy two different locations; that is, cloning creates a duplicate object which is no way connected with the original one.