Assignment operators, and compound assign operators should "return *this;". Meaning they return a non-const reference to the object being worked with.
You would NOT want to return test.end() b/c that would return an iterator (not a Test&) to an invalid element, ie, one past the last valid element, that must never be dereferenced, or even advanced forward/backward.
void Test::operator += (const TestX& t){
this->testAdd(&t);
//Test& Test::operator += (const TestX&){ Is it possible to do it like this as well? I have a feeling this is the correct way...
// this->testAdd(...);
}
The problem with your code is that you don't know anything about the life time of t. It could be a stack element and then you might have an invalid/dangling pointer.