隐式super.init()

Posted by Genie on June 12, 2020
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Cat1 {
    var name: String
    init() {
        name = "cat"
    }
}

class Tiger: Cat1 {
    let power: Int
    override init() {
        power = 10
        super.init()
        name = "tiger"
    }
}

如果我们不需要改变 name 我们可以不用写 super.init() , 系统会帮我吗隐式调用