When to use Clone (not the definition please)? I can initiate an object and use the object so why to use clone in the real world?
What is the motivation for shallow clone (I know that it copies the value types and make a reference to the the reference type) ?
please give me an examples from the real world and not the definition of clone,deep clone or shallow clone.
thanks in advance.
please give me an examples from the real world
If you have an object that's not thread safe but you can clone it to multiple independent instances you can then use those individual instances on different threads.
please give me an examples from the real world
One Example which I used some days ago:
I developed a component for printing different kind of documents based on a third party component.
In my context this is a complex construction and not "cheap" and "easy" to instantiate. Sometimes I need more than one printing-component. So use a shallow clone and only replace the config-object ("sub-objects" of printing-component which provides all printing relevant environment informations) gives me what I need with lees amount of work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With