By the time the reader reaches this point, the examples already have "private members", since the constructor parameters that we have been mutating are (unless I misunderstand something) also inaccessible outside the class aka constructor function.
Having private members correspond to constructor parameters is not the most general case, and I think the ability to have arbitrary instance variables is a better motivation for the construction introduced in "Private Members".
I guess one could cook up something with e.g. mutable vectors as constructor parameters, but then you would really need to do some kind of copying to make a difference.
Contact Details
bremner@unb.ca
Which part are you commenting on?
p. 89 v3.2.2
What's your suggestion?
By the time the reader reaches this point, the examples already have "private members", since the constructor parameters that we have been mutating are (unless I misunderstand something) also inaccessible outside the class aka constructor function.
Having private members correspond to constructor parameters is not the most general case, and I think the ability to have arbitrary instance variables is a better motivation for the construction introduced in "Private Members".
I guess one could cook up something with e.g. mutable vectors as constructor parameters, but then you would really need to do some kind of copying to make a difference.