@ -279,7 +279,7 @@ stringToEdit.value = "This string will be tracked."
|
||||
stringToEdit.value += " This edit will increment numberOfEdits."
|
||||
stringToEdit.value += " So will this one."
|
||||
print("The number of edits is \(stringToEdit.numberOfEdits)")
|
||||
// 打印 “The number of edits is 3”
|
||||
// 打印“The number of edits is 3”
|
||||
```
|
||||
|
||||
虽然你可以在其他的源文件中实例化该结构体并且获取到 `numberOfEdits` 属性的值,但是你不能对其进行赋值。这一限制保护了该记录功能的实现细节,同时还提供了方便的访问方式。
|
||||
|
||||
Reference in New Issue
Block a user