diff --git a/source/chapter2/10_Properties.md b/source/chapter2/10_Properties.md index f9ee85c8..bf305032 100755 --- a/source/chapter2/10_Properties.md +++ b/source/chapter2/10_Properties.md @@ -9,7 +9,7 @@ - [存储属性(Stored Properties)](#stored_properties) - [计算属性(Computed Properties)](#computed_properties) - [属性观察器(Property Observers)](#property_observers) -- [全局变量和局部变量(Global and Local Variables)](global_and_local_variables) +- [全局变量和局部变量(Global and Local Variables)](#global_and_local_variables) - [类型属性(Type Properties)](#type_properties) **属性**将值跟特定的类、结构或枚举关联。存储属性存储常量或变量作为实例的一部分,计算属性计算(而不是存储)一个值。计算属性可以用于类、结构体和枚举里,存储属性只能用于类和结构体。 diff --git a/source/chapter2/11_Methods.md b/source/chapter2/11_Methods.md index 108bca27..2f925d5c 100755 --- a/source/chapter2/11_Methods.md +++ b/source/chapter2/11_Methods.md @@ -164,7 +164,7 @@ println("The point is now at (\(somePoint.x), \(somePoint.y))") 上面的`Point`结构体定义了一个变异方法(mutating method)`moveByX`,`moveByX`用来移动点。`moveByX`方法在被调用时修改了这个点,而不是返回一个新的点。方法定义时加上`mutating`关键字,这才让方法可以修改值类型的属性。 -注意:不能在结构体类型常量上调用变异方法,因为常量的属性不能被改变,即使想改变的是常量的变量属性也不行,详情参见[存储属性和实例变量]("10_Properties.html") +注意:不能在结构体类型常量上调用变异方法,因为常量的属性不能被改变,即使想改变的是常量的变量属性也不行,详情参见[存储属性和实例变量](10_Properties.html#global_and_local_variables) ```swift let fixedPoint = Point(x: 3.0, y: 3.0)