I am a bit puzzled about why one can safely write
getValue() = 5;
in the below. The left hand side is a function. Why can we set that to 5?
int& getValue() { static int value = 10; return value;}int main() { std::cout << getValue() << std::endl; getValue() = 5; std::cout << getValue() << std::endl;}
This will return:
105