--- Comment #4 from bangerth at dealii dot org 2007-09-18 18:48 ---
To be quite clear: you can re-associate references (unlike pointers), so
when you do Ainst = Cinst, you copy the A-part of Cinst, but you still have
a 'B' whose 'A' component has just been overwritten.
W.
--
http:/
--- Comment #3 from photon at seznam dot cz 2007-09-18 15:12 ---
(In reply to comment #1)
> No, "B" is correct.
>
>
> A &Aref = Binst;
> Aref = Cinst;
>
> is the same as:
> Binst = (A)Cinst;
>
The compiler treats this case as Ainst = (A) Cinst.
--
photon at sezna
--- Comment #2 from photon at seznam dot cz 2007-09-18 12:01 ---
(In reply to comment #1)
> No, "B" is correct.
>
>
> A &Aref = Binst;
> Aref = Cinst;
>
> is the same as:
> Binst = (A)Cinst;
>
"Binst = (A)Cinst" would not compile (C is not derived from B).
--
pho
--- Comment #1 from pinskia at gcc dot gnu dot org 2007-09-18 11:00 ---
No, "B" is correct.
A &Aref = Binst;
Aref = Cinst;
is the same as:
Binst = (A)Cinst;
--
pinskia at gcc dot gnu dot org changed:
What|Removed |Added
-