While trying to grasp copying/copy constructors, and noticed that some things seem to be immutable by default (Strings, and Integers), while everything else is mutable by default. That leaves me wondering, when defining a copy constructor, what should I do deep copies of (... new...), and what should I just shallow copy? The 2 Types listed above were the only 2 that I could find that are immutable by default.
Are there more standard immutable types? I'm asking mainly because while I knew that Strings were immutable, the fact that Integers are kind of threw me.
Aucun commentaire:
Enregistrer un commentaire