Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
iOS Development
Very fundamental question in Obj-C
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="zijianz" data-source="post: 1407390" data-attributes="member: 253681"><p>First, I am really new in this area, please forgive my slow,</p><p>I saw codes like</p><p>'@property (nonatomic) double topSpeed; ' in the header file to declare a public variable in class. It will create a setter and getter automatically. </p><p></p><p>And we declare the implementation to the setter getters in the implementation file like</p><p>"@synthesize topSpeed = _topSpeed"</p><p></p><p>I wonder why do we use _topSpeed? Since we didn't declare a variable called _topSpeed.</p><p></p><p>To be more straightforward, what are topSpeed and _topSpeed exactly? Are those both variables or methods name? Is that mean whenever we declared @property type something, it will automatically generate a variable called _something?</p><p></p><p>THank you.</p></blockquote><p></p>
[QUOTE="zijianz, post: 1407390, member: 253681"] First, I am really new in this area, please forgive my slow, I saw codes like '@property (nonatomic) double topSpeed; ' in the header file to declare a public variable in class. It will create a setter and getter automatically. And we declare the implementation to the setter getters in the implementation file like "@synthesize topSpeed = _topSpeed" I wonder why do we use _topSpeed? Since we didn't declare a variable called _topSpeed. To be more straightforward, what are topSpeed and _topSpeed exactly? Are those both variables or methods name? Is that mean whenever we declared @property type something, it will automatically generate a variable called _something? THank you. [/QUOTE]
Verification
Name this item 🌈
Post reply
Forums
macOS & iOS Developer Playground
iOS Development
Very fundamental question in Obj-C
Top