Why is `const int& k = i; ++i; ` possible?
the increment ++iwill result in ++k which is not possible given that it was set const
the increment ++iwill result in ++k which is not possible given that it was set const That's a misunderstanding.
You may not change the value of the object through k but it can still be changed through other means. In other words, ++k is not allowed but ++i is still allowed, which will indirectly modify the value of k.
Here's an analogy from a non-computer world.
You may look through the window of a store and see what's inside but you won't be able to change what's inside the store. However, an employee, who is inside the store, can change the contents of the store. You will see that change from outside. You have const access or view access to the store while the employee has non-const access or change access to the store.