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 trialMichael Nees
1,070 PointsCreate a bass class
Got stuck with this question: Let's create a base class called 'Gem'. In 'Gem.h' define a class named 'Gem' which is a subclass of 'NSObject'.
Have tried: @interface Gem : NSObject; -(char)area;
What is not correct here?
10 Answers
Bill Walker
5,951 PointsIn your property, use
@property (nonatomic, strong) Ruby *ruby;
You could probably use other attributes as well, weak
, copy
, etc. strong
worked for me though.
Sebastian Döll
24,464 PointsI would say the semicolon is wrong
@interface Gem : NSObject
- (char) area;
@end
Michael Nees
1,070 PointsThanks Sebastian for your message. Unfortunately it's comes back with an error message.
Bill Walker
5,951 PointsYou have a semicolon after NSObject, remove it.
Also make sure you have @end at the bottom of the file
Michael Nees
1,070 PointsDone that too William , plus it has asked me to add @end. Any other ideas?
@interface Gem : NSObject -(char)area; @end
Bill Walker
5,951 PointsI took a look at the challenge, it's not asking for you to define anything other than the class.
@interface Gem : NSObject
@end
This worked for me.
Michael Nees
1,070 PointsMany thanks William... it worked! Got another small issue...
Comes back with message "check syntax on this code:
@interface Bling : NSObject @property (nonatomic) Ruby * ruby; @end
What could this be?
Cheers Michael
Michael Nees
1,070 PointsGreat, many thanks William! Note quite sure why I had to add "strong" (or weak or copy), but I guess I will find out more in the process.
Cheers Michael
Michael Nees
1,070 PointsGreat, many thanks William! Note quite sure why I had to add "strong" (or weak or copy), but I guess I will find out more in the process.
Cheers Michael
khristanyaburns
1,265 Pointsplease can you tell me what is the answer for Inheritance Challenge part 2