Deinit方法永远不会被称为 - Swift游乐场在下一个代码中,我试图调用deinit方法释放对Person Class实例的所有引用,Mark但是deinit从不被调用。为什么?class Person{
let name:String
init(name:String){
self.name = name
println("Person created")
}
deinit {
println("Person \(name) deinit")
}}var Mark:Person? = Person(name:"Mark")Mark = nil // Shouldn't the person deinit method be called here? It doesn't.
- 2 回答
- 0 关注
- 684 浏览
添加回答
举报
0/150
提交
取消