// Another example of type conversion (to a user-defined type) before the binding of the const reference. #include #include #include struct TwoDoubles{ double f1, f2; TwoDoubles(double d): f1{d/2}, f2{d/2}{ // A TwoDobles object can be constructed from a double } }; int main(){ using namespace std; const TwoDoubles &var = 6.4; // A temporary TwoDoubles object is made, by // activating the Twodoubles constructor on 6.4. // var becomes a const reference to the // TwoDoubles object. cout << var.f1 << ", " << var.f2 << endl; // 3.2, 3.2 }