Swift基类和NSObject关系

2021-06-30  本文已影响0人  搬码小能手
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

上一篇下一篇

猜你喜欢

热点阅读