isa pointer in objective-c

前端 未结 4 1866
感动是毒
感动是毒 2021-02-02 14:20

From this reference:

When a new object is created, memory for it is allocated, and its instance variables are initialized. First among the object’s vari

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 14:51

    The real benefit is a better understanding of the Objective-C runtime, which is actually quite complex compared to static languages like C++. The isa pointer, in practical terms, isn't really used all that much unless you're hacking the runtime to do something special. This guide has more info on how it is used by the runtime.

    You shouldn't really use the isa directly in production code. It's like retainCount - it's important you understand it but you shouldn't ever call it.

提交回复
热议问题