Update 21_Protocols.md

另一处表达不准确
This commit is contained in:
Alan
2014-06-18 10:51:10 +08:00
parent 29ba86bb15
commit 7ee7fce4ed

View File

@ -67,7 +67,7 @@ protocol SomeProtocol {
}
```
在协议中定义类属性 (type property)时使用`class`前缀关键,即使在结构体或者枚举中实现该协议时是使用`static`关键
在协议中定义类属性 (type property)时使用`class`前缀关键,即使在结构体或者枚举中类属性是要求使用`static`前缀关键
```swift
protocol AnotherProtocol {
class var someTypeProperty: Int { get set }
@ -119,7 +119,7 @@ var ncc1701 = Starship(name: "Enterprise", prefix: "USS")
协议方法支持`变长参数(variadic parameter)`,不支持`默认参数(default parameter)`
前置`class`关键字表示协议中的成员为`类成员`;当协议用于被`枚举``结构体`遵循时,则使用`static`关键字。如下所示:
像类属性的要求一样,协议中定义类方法时也总是使用`class`关键字,即使类方法在`枚举``结构体`中实现时要求使用`static`关键字
```swift
protocol SomeProtocol {
class func someTypeMethod()