I recently started learning C++ and stumbled upon this issue. Pardon me if it sounds dumb but why can't we initialize a value to a reference variable through
int r= 20;
int &ref = r;
ref(20);
although this method of initializing value of 20 works when not using it as a reference variable.
IDE: C++11
Why is this so?
Aucun commentaire:
Enregistrer un commentaire