NSString immutable allows to change its values?

后端 未结 3 495
旧巷少年郎
旧巷少年郎 2020-12-19 11:07

The code below compiles and runs, BUT according to all iPhone development books and Apple documentation it shouldnt! Can someone please explain to me how come immutable NSS

3条回答
  •  一整个雨季
    2020-12-19 11:40

    You aren't mutating the string, you are just reassigning the variable test to point to a different string. The original string hasn't been modified.

提交回复
热议问题