0

I was wondering about how the setter methods get created and am I right in saying this:

Retain/Strong attribute:

- (void)setProperty:(Class *)class
{
    variable = [class retain];
}

Assign/Weak attribute:

- (void)setProperty:(Class *)class
{
    variable = class;
}

Copy attribute:

- (void)setProperty:(Class *)class
{
    variable = [class copy];
}

Are assign and weak even the same either?

Thanks in advance!

bbum
  • 162,346
  • 23
  • 271
  • 359
user1628311
  • 166
  • 1
  • 3
  • 12
  • 1
    All are not correct. Google and you will find same sample code of manual creation of setters and getters – Anoop Vaidya Jan 10 '13 at 18:57
  • Yeah, that's the general idea, but the devil is in the details. With a retained property you need to be sure to release the prior one. And several other minor points in case of concurrency, etc. – Hot Licks Jan 10 '13 at 19:37
  • possible duplicate of [What equivalent code is synthesized for a declared property?](http://stackoverflow.com/questions/5350563/what-equivalent-code-is-synthesized-for-a-declared-property); see also [Accessor implementation of properties](http://stackoverflow.com/questions/10129203/accessor-implementation-of-properties?lq=1) – jscs Jan 10 '13 at 20:31

0 Answers0