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

//2    
double a = 2.71;
int &b = a;
Explanation
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.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з C++
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести