Wrong const attribute?

Paolo Invernizzi arathorn at fastwebnet.it
Fri Sep 23 03:20:25 PDT 2011


Thank you all very much.
Paolo

On Sep 22, 2011, at 7:12 PM, Jonathan M Davis wrote:

> On Thursday, September 22, 2011 04:12 Paolo Invernizzi wrote:
> 
> The error is a bit confusing but essentially correct. Bar has an immutable 
> member variable. Once it's been initialized, that immutable member variable 
> can never be changed, so you can never assign to a variable of type Bar. 
> Naturally, that includes the member variable in Foo. So, when you constructed 
> your f variable, the bar member variable was initialized, and after that, it 
> can never be assigned to. So, when you try and do it, you get an error. The 
> error message could definitely use some improvement though.
> 
> - Jonathan M Davis



More information about the Digitalmars-d-learn mailing list