ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

Explain Shallow and deep cloning.

Cloning of objects can be very useful if you use the prototype pattern or if you want to store an internal copy of an object inside an aggregation class for example.

Deep cloning - You clone the object and their constituent parts.

It should be used when it is inappropriate to separate the parts; the object is formed of, from it.

Shallow cloning - You clone only the object, not their parts. You add references to their parts.

It should be used when it is adequate to have the references added to the cloned object

 

Related Posts Plugin for WordPress, Blogger...
Flag Counter