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

前端 未结 6 1026
无人及你
无人及你 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:39

    really no difference, in assigning to other object but it will make great deal of difference if the assignment is done other way around means like self.name = theNameToDisplay; this will be different as the value in theNameToDisplay will get affected by the @property attributes.

提交回复
热议问题