What is the difference between _name and self.name if name was a NSString

前端 未结 6 1024
无人及你
无人及你 2020-12-22 13:26

What is the defference if I called

NSString *theNameToDisplay = _name;

or

NSString *theNameToDisplay = self.name;
<         


        
6条回答
  •  [愿得一人]
    2020-12-22 13:45

    The first one is to access a variable directly. The second one is accessing it through the property.

提交回复
热议问题