Is there a good reason why I should not do something like this? Example:
I have a class MyClass. In there I have this implementation:
- (id)copyWithZone:(NSZone*)zone {
MyClass *copy = [[MyClass allocWithZone:zone] init];
copy.someproperty = [[self.someproperty copy] autorelease];
return copy;
}
Instead of that, I found a snippet that looks like this:
- (id)copyWithZone:(NSZone*)zone {
MyClass *copy = [[[self class] allocWithZone:zone] init];
copy.someproperty = [[self.someproperty copy] autorelease];
return copy;
}
The difference is, that the first one just uses the name if its own class humanly readable just as if it was any other class. And the second one asks self for what class that is. Does that make a difference, or are both totally okay to use in this case?