On Oct 26, 11:47 am, Jonathan Lane <jonathan.la...@googlemail.com>
wrote:
On Oct 26, 1:35 am, ww <mrw...@gmail.comwrote:
I read a couple of books that tells this, but seems not one can
explain why is this
For references, the standard says that you cannot reseat them. I guess
that the technical reason is that when you call operator= it modifies
the value in the reference not the reference itself - which is what
you would expect.
The technical reason is that it is illegal to create a reference
or a const object with a trivial constructor without
initializing it. Regardless of whether they are members or not.
If they are members, of course, the only way you can initialize
them is in the initialization list; once you get into the body
of the constructor, they've been initialized.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34