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 trialmartin chibwe
3,901 PointsGem.h
How do I create a sub class in this compiler? I don't get the question
I thought it
@interface Gem : NSObject { } Caitlin Rush
3 Answers
Hayden Evans
15,399 PointsIf "Gem" is the class you are creating that inherits from NSObject, (like most custom classes do in iOS) write the statement you made above as:
@interface Gem : NSObject
(Properties go here)
@ end
You do not need the braces { } in this particular case.
martin chibwe
3,901 PointsI tried that this is what I wrote. Are you looking at the same challenge?
thanks for helping by the way
@interface Gem : NSObject
@property (nonatomic, strong) float *height ; @property (nonatomic, strong) float *width ;
@end
Hayden Evans
15,399 PointsI wasn't looking at the challenge but I went back and did it just now. For the first part of the challenge, it is only asking you to create the "Gem" class that inherits from NSObject. You do not need to type any properties, just the @interface line (as we discussed earlier) and the @end line. The second part of the challenge is very similar, only this time you are creating the "Ruby" class that inherits from the "Gem" class. Again, you are only worried about the @interface line and the @end line. For the final part of the challenge, you are now declaring a property within the "Bling" class. This property is of type "Ruby". By the looks of what you have typed above, you have some properties that are arbitrary and not asked for in this particular challenge. You should only be writing one @property in this challenge called "ruby" of type "Ruby". You are very close to having this correct, just change out the type "float" for type "Ruby" followed by the property named "ruby". Also, I found that it is particularly picky about the order of nonatomic and strong (although it makes no difference in actual iOS programming). Just be sure to place strong before nonatomic.
martin chibwe
3,901 PointsIt worked Thanks!
Hayden Evans
15,399 PointsNo worries! Glad I could help!