alloc and init what do they actually do

后端 未结 5 1782
再見小時候
再見小時候 2020-11-28 07:28

Can someone explain to me what init and alloc do in Obj-C. I am reading this obj-c book that gives an example of creating object but it does not really go into details of wh

5条回答
  •  没有蜡笔的小新
    2020-11-28 07:45

    Alloc will allocate the memory for the object, but Init puts the object into the memory and sets the default values.

提交回复
热议问题