Let's say I have two classes: Base class and sub class like this:
class Base{
var name: String?
init() {
name = "The base class"
}
deinit {
println("call Deinitialization in base class")
name = nil
}
}
class Sub: Base{
var subName: String?
init() {
super.init()
subName = "The sub class"
}
deinit {
println("call Deinitialization in sub class")
subName = nil
// does it really call super.deinit() ?
// or assign name = nil ?
}
}
When the deinitializer of sub class is called, does it call super.deinit()
to assign nil to name
variable? Or I have to assign by hand in deinitializer of subclass?