samedi 9 juin 2018

How a const reference bind to an object of a different type [duplicate]

This question already has an answer here:

The type of a reference and the object to which the reference refers must match exactly. It's mean is that,

double dval = 3.14; 
int &refi = dval; 

will be given a compiler error.

But when a const reference binds to different type object is allowed. How is it possible (I'm asking an explenation from c++ standards view)and why?

Regards, Tunahan.

Aucun commentaire:

Enregistrer un commentaire