CPP_Modules icon indicating copy to clipboard operation
CPP_Modules copied to clipboard

module 4 fix (deep copy)

Open toukoum opened this issue 2 months ago • 0 comments

Hey 👋,

I just completed Module 04 and noticed a couple of things that might need some attention. Since your repo is quite popular, I thought it would be important to address these issues to avoid any errors. While reviewing, I realized there were a few oversights for Exercise 03 in Module 04:

  • For the copy constructor and assignment operator overloading, it seems like a deep copy isn't being made. Currently, only the pointers to the source are being copied.

  • Regarding the learnMateria() function, to adhere to the main requirements of the subject without causing any memory leaks, it's necessary to copy the Materia passed as parameters.

For example:

src->learnMateria(new Ice()); // a copy of Ice is needed to manage deletion properly

Here’s the main of the subject:

image

This is my first pull request, so please let me know if everything looks good to you or if there’s anything I could improve. Could the explanations or formulations be better?

toukoum avatar Apr 17 '24 08:04 toukoum