Using self->ivar when accessing instance variables directly

后端 未结 4 1219
孤独总比滥情好
孤独总比滥情好 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:32

    There's no reason you shouldn't write it that way. I think people tend to write it the other way because they try to avoid shadowing their ivars anyway, so there shouldn't be any ambiguity in what variable they're talking about — and it's shorter.

提交回复
热议问题