/**
实例方法
*/
class MyPoint {
var _x: Double = 0.0
var _y: Double = 0.0
func setX(x: Double,y: Double) -> Void {
_x = x
_y = y
}
func show() {
print("_x==\(_x) _y==\(_y)")
}
}
var p0 = MyPoint.init()
p0.setX(x: 10.0,y: 10.0)
p0.show()
原文链接:https://www.f2er.com/swift/322414.html