When do I need to have both iVar and a property?

前端 未结 2 834
北海茫月
北海茫月 2021-01-28 04:21

I see some examples sometimes would declare a property as well as variable other times they do not .e.g. some time I see code like this

@interface Test : NSObjec         


        
2条回答
  •  孤独总比滥情好
    2021-01-28 04:48

    Using ivars instead properties is only useful if you want @protected access (access from subclasses only), or support the old runtime (which required both).

提交回复
热议问题