Using self->ivar when accessing instance variables directly

后端 未结 4 1221
孤独总比滥情好
孤独总比滥情好 2020-12-30 10:15

I have noticed that most Objective-C coders never use the self->ivar syntax when accessing instance variables directly. Most sample code that I see simply re

4条回答
  •  隐瞒了意图╮
    2020-12-30 10:27

    Objective C automatically appends an underscore to the i-var name, so when you see "_someVar" it is implicitly of class scope. The underscore is enough of a visual marker to make its scope clear without adding self->.

提交回复
热议问题