In C++,
function() = 10;
works if the function returns a variable by reference.
What are the use cases of it?
A very normal use case is when you write an array like class. Here you want to overload the operator [] so as you can do a[0] = 10; In that case you would want the signature to be like int& operator[](int index);
operator []
a[0] = 10;
int& operator[](int index);