Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 212 Bytes

方法.md

File metadata and controls

17 lines (11 loc) · 212 Bytes

Methods

在变异方法中分配给self

struct Point {
	var x = 0.0, y = 0.0
	
	mutating func moveBy(x deltaX: Double, y deltaY: Double) {
		self = Point(x: x + deltaX, y: y + deltaY)
	}
}