const and immutable member variables in classes

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 2 15:19:30 PST 2016


On 02/02/2016 03:02 PM, anonymous wrote:

 > I'm not sure what you mean by "default assignment".

I think I meant member-wise assignment. :)

 > I'd say it works
 > more simply with classes, because they're reference types. It's the same
 > as using pointers to structs:
 >
 > auto a = new S();
 > auto b = new S();
 > a = b; /* no problem */

Exactly. This aspect of reference types had not occurred to me until 
recently.

Ali



More information about the Digitalmars-d-learn mailing list