1
2
3
4
5
6
Use the "Verify Solution" button to get AI feedback on your C++ code.
You are provided with a ResourceHolder class designed to manage a dynamically allocated integer array. The current implementation initializes the resource but suffers from severe memory management issues, specifically related to copying and destruction, which can lead to memory leaks, double-frees, or undefined behavior. Your task is to correctly implement the destructor, copy constructor, copy assignment operator, move constructor, and move assignment operator to ensure that the ResourceHolder class properly manages its dynamically allocated resource following the Rule of Five (or modern C++ approaches for resource management that rely on these fundamental operations).