> C# does that and manages just fine with operator overloading. Each operator function is static and returns a new value rather than modifying “this”.
C++ does as well with certain operators, such as operator+. These are commonly implemented as free functions. But certain operators, such as operator= or operator+=, are supposed to mutate the object. In this case you simply can't return a new object.
C++ does as well with certain operators, such as operator+. These are commonly implemented as free functions. But certain operators, such as operator= or operator+=, are supposed to mutate the object. In this case you simply can't return a new object.