class AreaSectorLineOverlay: MKPolyline {
var id: String!
var nickName: String!
var locationName: String!
convenience init(coordinates coords: UnsafePointer<CLLocationCoordinate2D>, count: Int, id: String, nickName: String, locationName: String) {
self.init(coordinates: coords, count: count)
self.id = id
self.nickName = nickName
self.locationName = locationName
}
}
为什么代码错了?错误是(&#39; self&#39;在self.init调用之前使用)和最后一个函数&#init;(坐标coords:UnsafePointer,count:Int,id:String,nickName:String,locationName:String )&#39;错误是(在从初始化程序返回之前,所有路径都没有调用Self.init)
class A {
var a1: String!
init() {
}
convenience init(a1: String) {
self.init()
self.a1 = a1
}
}
class B: A {
var b1: String!
convenience init(a1: String, b1: String) {
self.init(a1: a1)
self.b1 = b1
}
}
let b = B(a1: "a1Test", b1: "b1Test")
print(b.a1, b.b1)
没有这样的错误,打印结果是(a1Test b1Test)