Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShaun Kelly
5,648 PointsSelf?
So self refers to the particular instance of that class. So if the class is a subclass of NSObject. When i refer to self within that class i'm referring to NSObject in this case ?
1 Answer
Shaun Kelly
5,648 PointsSo in this example am I referring to NSString and is there any other documentation or further information about this ?....
#import "BlogPost.h"
@implementation BlogPost
-(id) initWithTitle:(NSString *)title{
self = [super init];
if (self) {
self.title = title;
}
return self;
}
Jayden Spring
8,625 PointsCan you post your BlogPost.h please so we can see the super class. What you are doing seems unclear.
Jayden Spring
8,625 PointsJayden Spring
8,625 PointsNo, if you called super you were.
When you call self you are referring to anything within the braces ({ }) for that class.