I was trying to demonstrate basic inheritance to someone and how the super initializer is always called by default when overriding an init:
class Animal{
init(){
println("Animal has been initialized!")
}
}
class Dog:Animal{
var feet:Int = 4
override init(){
println("Dog has been initialized!")
}
}
var d = Dog()
Why is it that I get {__lldb_expr_380.Animal feet 4}
on the last line? It goes away when I create an instance variable under the animal class.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…