+ Start a Discussion
sfdc startsfdc start 

plz answer the interview question..

1.Create a Generic Deep clone functionality in Salesforce to clone a certain master record and all the child records associated to it. The child records can be of Lookup or Master Detail relationship. plz give any example...
2.what is meant by generic deep

Clone is analogous to Pass By Reference while DeepClone is analogous to Pass By Value.
In memory level clone copy the reference and deepclone does not copy the reference .
When you are cloning, just a pointer is being created to the already existing record/collection. Any changes that you do on Clone are applied on Original too and vice-versa (actually the record/collection is just 1 while the pointers are 2).
In DeepClone, an exact replica of the record/collection is being created somewhere else in memory, changes to the deepClone or the original are independent of each other and would not reflect on the other.