Swift基类和NSObject关系

方野
2023-12-01
class SwiftClass {
}

class OCClass: NSObject {
}

var ref = SwiftClass()
var ocref = OCClass()

print("Swift对象的内存:", Mems.memStr(ofRef: ref))
print("NSObject对象的内存:", Mems.memStr(ofRef: ocref))
Swift对象的内存: 0x000000010000c3a8 0x0000000200000003
NSObject对象的内存: 0x021d80010000c319 0x0000000000000000

结论:个人推测,Swift基类有可能继承自NSObject

 类似资料: