The true definition of immutability?

后端 未结 10 2088
被撕碎了的回忆
被撕碎了的回忆 2021-02-09 03:15

I am wondering how immutability is defined? If the values aren\'t exposed as public, so can\'t be modified, then it\'s enough?

Can the values be modified inside the type

10条回答
  •  南旧
    南旧 (楼主)
    2021-02-09 03:45

    I've learned that immutability is when you set everything in the constructor and cannot modify it later on during the lifetime of the object.

提交回复
热议问题