What does isa mean in objective-c?

后端 未结 2 869
暖寄归人
暖寄归人 2020-12-04 08:51

I would like to know the meaning of the below written lines with an example. I\'m unable to understand what the lines actually mean. The lines are from google\'s objective-c

2条回答
  •  情书的邮戳
    2020-12-04 09:08

    When objects are allocated by the Objective-C runtime, all the memory where instance variables reside is zeroed out for you, so there is no need to set instance variables to 0 or nil. You can set them to any value you want. Some developers even ignore the redundancy and set instance variables to 0 anyway just for explicitness or descriptive purposes.

    isa means “is a”. Every Objective-C object (including every class) has an isa pointer. The runtime follows this pointer to determine what class an object is, so it knows what selectors the object responds to, what its super class is, what properties the object has, and so on.

提交回复
热议问题