I have an objective-c class with member variables. I create getters and setters for each of them. Mostly for educational purposes. My setter looks like this:
- (void) setSomething:(NSString *)input {
something = input;
}
However, in C ++ and other languages I've worked with in the past, you can reference a member variable using a pointer this, for example this->something = input. In objective-c, this is called self. So I was wondering if something like this is possible in objective-c? Something like that:
- (void) setSomething:(NSString *)input {
[self something] = input;
}
But this will cause getter for something. Therefore, I am not sure. So my question is:
Is there a way that I can perform an assignment using a self pointer?
If so, how?
Is it good practice or is it evil?
Thank!