struct Point{
var x = 0
var y = 0
var z = 0
init(_ x: Int, _ y: Int, _ z: Int){
self.x = x
self.y = y
self.z = z
}
}
let MyFirstPoint = Point(1,2,3)
let MySecondPoint = Point(2,3,4)
extension Point {
static func + (left: Point, right: Point) -> Point {
return Point(x: left.x + right.x, y: left.y + right.y, z: left.z + right.z)
}
}
var ThirdPoint = MyFirstPoint + MySecondPoint
Ошибка:
Swift Ver. 3.1.1 (Release)
Platform: Linux (x86_64)
ERROR at line 19, col 21: extraneous argument labels 'x:y:z:' in call
return Point(x: left.x + right.x, y: left.y + right.y, z: left.z + right.z)
^~~~ ~~~ ~~~