class Parrot:Bird, Pet {
override required init(name: String) { //感觉override在前更好,因为定义时父类在前,协议在后
super.init(name: name + " " + name)
}
override required init(name: String) { //感觉override在前更好,因为定义时父类在前,协议在后
super.init(name: name + " " + name)
}
2017-09-25
Swift 中循环里添加步长改为:
for i in stride(from: 0, to: 10, by: 2) { //to为开区间,through为闭区间
print("Stride 2")
}
for i in stride(from: 0, to: 10, by: 2) { //to为开区间,through为闭区间
print("Stride 2")
}
2017-09-24
swift3 需要将inout放到参数类型前面
func +=( left: inout Vector3, right: Vector3){
left = left + right
}
func +=( left: inout Vector3, right: Vector3){
left = left + right
}
2017-09-12