'initializing' : cannot implicitly convert a 'type1' to a 'type2' that is not const
In C++, you create a reference to another object by initializing the reference using the address-of operator (&). Creating a reference object allows you to modify the original object by changing the reference object. It is similar to modifying a variable in C through a pointer to that variable, but the notation is cleaner because you do not need to dereference the pointer to access the variable.
If you try to create a reference (“initializing a reference”) to an object of another type, the compiler will issue error C2607. For example, if you create an int reference to a float variable the compiler will issue this error unless the float variable is const. Otherwise, every time you modified the int variable, the compiler would have to supply a conversion to the float variable; and every time you modified the float variable, the compiler would also have to supply a conversion to the int variable.
The reference to type2 must be one of the following:
The following is an example of this error:
float f;
int& ri2 = f; // error, f is not an int l-value