I'm writing the overload for the assignment operator for an object that has a pointer to an int array inside of it. The assignment operator does not work 100% of the time. If I do something simple, such as A = B, where A and B are both the objects I am working with, then it works fine, and the values are copied from B to A. However, if I write code such as A = B = C = D, the assignment operator does not work.
I debugged my code and ran a couple of tests. First, I just printed out the array's values before the line of code A = B = C = D. The values from the array printed out just fine. I also did A = B, before A = B = C = D, and B's array values were assigned to A. Upon reaching A = B = C = D, the program could no longer read the array and instead read the value of each index of all the arrays as some random long negative number. Here is my code for the assignment operator.