which are the differences between those 3 implementations?
Box Box::operator+(const Box& b)
            {
                Box box;
                box.length = length + b.length;
                box.breadth = breadth + b.breadth;
                box.height = height + b.height;
                return box;
            }
or:
Box Box::operator+(const Box& b)
    {
        Box box;
        box.length = box.length + b.length;
        box.breadth = box.breadth + b.breadth;
        box.height = box.height + b.height;
        return box;
    }
or:
 Box Box::operator+(const Box& b)
    {
        Box box;
        box.length = this->length + b.length;
        box.breadth = this->breadth + b.breadth;
        box.height = this->height + b.height;
        return box;
    }
I noticed that with the second implementation, results are different wrt the other two implementations. In the first case i suppose that this-> is implicit. In the third case this is always the object who call that function, but the second case is equal to the others?
Many thanks!
Would be another possible solution to use:
example example::operator+(const example& obj2)
{
    example tmp_obj = *this;
    tmp_obj.a = tmp_obj.a + obj2.a;
    tmp_obj.b = tmp_obj.b + obj2.b;
    return tmp_obj;
}
 
     
     
    