I read somewhere that in C++ you can’t give a definition like:
int& a;
but only:
int b;
int& a=b;
Since & is a reference of the other variable, it cannot be defined separately.
On the other hand, I see it defined separately in code all the time.
Could someone explain to me how can you define
int & a;
without specifying a reference to which variable it is?
You might see it in a class, but you need to assign it upon initialization in all constructors, e.g.