Think of memory like URLs and websites.
If you want to access some memory, the computer checks the URL, the URL brings you to a website, and the website contains the data the computer wants.
Shallow copy would be like copying the URLs. If you access the URL, you’ll get whatever data the URL brings you to. The website may or may not have changed.
Deep copy would be like going to the URL and copying the HTML of the website, and then saving that under a different URL. This way, even if the website at the original URL changes, the one you deep copied will remain the same as when you originally copied it.
Latest Answers