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 trialmaddy kramer
631 PointsWhat is the subclass of Gem
@class Gem; @interface Gem: NSObject, @property (nonatomic, strong) Gem, ruby;
6 Answers
Stone Preston
42,016 Pointsmaddy kramer. you just need to create a class called Ruby that is a subclass of Gem. here is a general form of doing that:
@interface Classname : Superclassname
@end
now the challenge says the class name is Ruby and its super class should be Gem
Stone Preston
42,016 Pointscan you make it a bit more clear what your question is or what task you are having trouble with? looking at your current question you have a syntax error in your property and its also of the wrong type:
@property (nonatomic, strong) Gem, ruby;
needs to be
@property (nonatomic, strong) Ruby *ruby;
Brenden Konnagan
16,858 PointsIf you are curious about what class Gem is a subclass of... the answer lies in the header file. @interface Gem: xxxx
this tells you what the class is inheriting from.
maddy kramer
631 PointsNow let's define a subclass of Gem named Ruby. Switch over to 'Ruby.h' and create a class named 'Ruby' which is a subclass of 'Gem'.
I'm trying to figure it out but I have no idea what is the answer!
Maddy
Brenden Konnagan
16,858 PointsFollow the example of Gem... It is a subclass of NSObject. Notice how it is defined and follow that as a pattern. ;-)
maddy kramer
631 PointsIs this the answer? @interface Gem: NSObject @property (nonatomic, assign) NSNumber *Ruby; @end