I tried to clone an object and change member functions of new clonned object. If it is shallow copy and according to wiki page, shallow copy and original object point to sam
Shallow copy of obj1 creates another instance obj2 of your CloneExample class (obj1!=obj2). They don't share value members.
But if our class contained a reference type, for example java.util.Date
, then changing it's value would be reflected in both object if they shared reference to that java.util.Date
.
In Java, what is a shallow copy?