i want to assign a content of one variable to another
A:
The purpose of a setter is not to assign one variable to another.
What you want is a method.
Wade Williams
2010-08-05 16:40:37
A:
I am guessing the poster wanted something like this:
@interface MyClass : NSObject
{
int someRandomiVar;
}
@property int veryImportantNumber;
@end
@implementation MyClass
@synthesize veryImportantNumber = someRandomiVar;
@end
Steam Trout
2010-08-05 16:55:14
That may be what he wanted, but it's horrible design and not the purpose of a setter. If he really wants to assign a variable to another based on a method call, then he should write a method: [myObj assignValueOfSomeRandomiVarToVeryImportantNumber]; (not a suggested naming to be sure) - Yes, in reality it's just semantics, but if you corrupt the purpose of your setters you can't depend on their behavior at all.
Wade Williams
2010-08-05 17:02:05
Not that I say that's a good coding practice, mind you. I am just trying to decipher the vague meaning of the OP's question :)
Steam Trout
2010-08-05 17:28:41