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 trial

iOS Objective-C Basics (Retired) Introduction to Objective-C Inheritance

Let's create a base class called 'Gem'. In 'Gem.h' define a class named 'Gem' which is a subclass of 'NSObject'.

What is wrong with my code @property(nonatomic, strong) Ruby*ruby. It says did you declare a variable called Ruby?

10 Answers

looks like you forgot a semicolon after your property declaration:

@property(nonatomic, strong) Ruby*ruby;

it also unconventional not to put a space between the class name and the *.

@property(nonatomic, strong) Ruby *ruby;

is a more conventional pointer declaration

I still get Bummer! Did you declare the 'Ruby' interface in 'Ruby.h'? I dont do anything to the Gem.h file right?

are you on task 3? which task are you on

task 2

you need to switch to Ruby.h. task 2 states: Now 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'.

class definitions generally look like this:

@interface ClassName : SuperClass

@end

so for your Ruby class, the classname is Ruby and it needs to inherit from your Gem class.

so @interface Ruby *ruby?

or is it @interface Ruby: Gem?

never mind got it

what about part three? I am confused about inheritance

you need to switch to Bling.h and add a property of the class Ruby named ruby. you had it in your original post

@property(nonatomic, strong) Ruby *ruby;

because I thought we enter @property (strong, nonatomic) Ruby*ruby;

yes. enter that in bling.h

@interface Bling : NSObject

@property (strong, nonatomic) Ruby*ruby;

@end

Thank you so much!

@Stone Preston This was incredibly helpful for me as well, Thank you!