You always assign references to objects. In your example, obj and obj1 are referencing the same object, that is, if you call a method on obj1 it is the same as calling a method on obj. Therefore, if you want to work on a copy of an object, you have to clone it like you did for obj2.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jul 30, 2001
Thanks Ilja, By this you mean that the cloned object obj2 will not share the same reference as obj but will create a new reference. Am I right? Thanks, Vijay