Question re "adding" arrays together
Well, I tried asking this on Stack Overflow. Really unhelpful, three people made comments unrelated to my question then a moderator closed off commenting before I could clarify. I really don't like Stack Overflow sometimes! Anyway, in the C++ course, the challenge of Queue Management part II is to join together two arrays/vectors with a member function in a class that returns a new Queue object (of class Queue). I tried this: myClass& operator +(myClass &obj) { obj.myArr[size] = this->myArr[size] + obj.myArr[size]; return obj; } It doesn't return the two functions joined together, it just returns obj (which is the second array/vector). I'm a bit stumped. I could solve it if I rewrote the entire format of the program, but that would defeat the point. What error have I made in my program? One... person on Stack Overflow said I was trying to add two pointers, but I'm not - they're integer values. I get an error when I try to add pointers, anyway.