Amazon.com Widgets Synthesized Accessor Methods
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 19, 2013, 02:25:33 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Chapter Study
| | |-+  Chapter 7 - More on Classes
| | | |-+  Synthesized Accessor Methods
Pages: [1]   Go Down
Print
Author Topic: Synthesized Accessor Methods  (Read 412 times)
DJWBrown
Newbie
*
Posts: 2


Email




« on: September 01, 2011, 10:28:29 AM »

Hi
I wonder if someone could help with my understanding regarding Synthesized Accessor Methods.

After studying each program example I tend to experiment with the program to try and gain further understanding. So again with prog7.1 I started experimenting and I found if i deleted the instance variables (numerator and denominator) but kept the @property numerator, denominator and @synthesize numerator, denominator entries the prog still ran without errors and gave the expected output. This has confused me a little, as I understood it was the instance variables that held the data, if there're no instance variables where is the data being stored?

Thanks in advance.
Logged
bpedit
Jr. Member
**
Posts: 65


Email




« Reply #1 on: September 01, 2011, 01:05:44 PM »

The synthesized accessor methods are more or less implementing the instance variables when producing the setter and getter methods. So maybe, internally, this implementation also serves to declare as well. But I think, even though the code may run without the specific declarations in the header, it would be terrible practice to omit them for documentation purposes if nothing else.
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.