You may be a little confused about the difference between “initialization” and “assignment”. In C ++, they are different, and understanding the difference is critical to understanding the language. Ignoring Links:
int x = 1;
Links can only be initialized.
int & r = x;
There is no way to reinitialize a link.
Regarding your question, regarding consts, you can initialize the constant const with a value of const:
const int & r2 = 42;
anon
source share