Swift基类和NSObject关系

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

你可能感兴趣的:(Swift基类和NSObject关系)