Which version of the code will be compiled?
double a = 2.71;
const int &b = a;

double a = 2.71;
int &b = a;
A non-constant reference can only be assigned to an object of the same type as the reference type.

A constant reference can be assigned to an r-value or to an object whose type does not coincide with the reference type.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes