手把手带你学习Swift3.0(24):析构函数

//: Playground - noun: a place where people can play

import UIKit

class Person {
    var name : String = ""
    var age : Int = 0
    
    // 重写析构函数, 监听对象的销毁
    deinit {
        print("Person --- deinit")
    }
}

var p : Person? = Person()

p = nil

你可能感兴趣的:(手把手带你学习Swift3.0(24):析构函数)