I follow several textbooks and I fall with myself. Can anyone help?
I have the following init, which is an instance method.
- (id) initWithScore:(int) s {
self = [super init];
if (self) {
score = s;
}
return self;
}
Now, after reading the code, I set self to super init, so self now points to super. Then I check to see if self is valid and sets the value to the value that I sent to my InitWIthScore. I still have it.
But now I return self, which points to super, so how do I return my subclass?
Therefore, let's say that someone calls my class, passing through 100, my code returns super not a class, so how does it work? How does the call code have a value of 100 in the account?
Of course, yes, it really works, but I have no idea why: - (