First one returns a reference, and takes a reference - this means that you can theoretically change both arguments, and you return a reference, which can be changed too. This is usually not what you want to do( 2 + 3 doesn't return 5 that can be reassigned to 17).
Second one is the same, but no reference returned.
Third has const reference - a reference which can't be modified. This is usually what you want to do, since you get element fast(you get the element), but you can't change it(incidentally or not).
Fourth one is like a third, but you copy an argument, and make it const for some reason. This makes little sense.
And the last one just takes a copy.
There isn't much difference between some of them - some of them make little sense if you think about what operator+
has to do; the area where they differ is mostly how you get the argument - and most of the time, you want to get it fast, so const ClassName& other
is probably your best bet.