Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7490615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:41:10+00:00 2026-05-29T15:41:10+00:00

What is the defference if I called NSString *theNameToDisplay = _name; or NSString *theNameToDisplay

  • 0

What is the defference if I called

NSString *theNameToDisplay = _name;

or

NSString *theNameToDisplay = self.name;

I know it might be a silly question but I see both versions used a lot and I don’t spot a difference in the output?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:41:10+00:00Added an answer on May 29, 2026 at 3:41 pm

    Assume you have in your .m file this line (and don’t have any overriden methods to direct access to _name)

    @synthesize name = _name;
    

    It mean that property name (self.name) will use variable _name when you try to access it. In this case self.name is equal to _name


    But if you have dynamic property for name, something like this :

    -(NSString)name{
        return @"1234";
    }
    

    then there is a difference. self.name will always return 1234, but _name can be not equal to this value.

    Example:

    _name = @"555";
    NSLog(_name);
    NSLog(self.name);
    

    Result:

    2012-02-09 14:27:49.931 ExampleApp[803:207] 555
    2012-02-09 14:27:49.933 ExampleApp[803:207] 1234
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a method called foo. What's the difference between: [self foo];
Okay, this is a simple question, but I'd like some oppinions on the correct
I know it makes little difference to a project but, assuming you use #defined
I want to know that difference between following two lines name1 = [[NSString stringWithUTF8String:(char
I had know the difference between F# library and .NET library when I called
const and volatile are called cv-qualifier by the C spec. What is exactly defference
Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the
Possible Duplicate: Understanding NSString comparison in Objective-C Was just reading up about equality vs
I've created a custom button called TaskUIButton that inherits from UIButton. The only difference
I have a method that gets called any time a control on my view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.