const attribute makes whole element const?

Namespace rswhite4 at googlemail.com
Sun Sep 9 17:05:08 PDT 2012


I had never problems with that in C++.
If I have members which are const because they are assigned only 
one time and needs no other assignment, why should I declare this 
member not as const?

In the example I know exactly that I assign only one time a name 
to this struct, so why I should not declare it as const?

Other example: you have a unique birthday date. This is const you 
cannot change it like a name or a telephone number. So if you 
have a Person struct which holds any data of a single people, you 
won't declare the date as const? I would. And I had expected that 
this is normal behaviour.



More information about the Digitalmars-d-learn mailing list