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

Code Challenge: Inheritance

Hey everyone! I'm stuck on task 3 of the 'Inheritance' code challenge for 'Objective-C Basics'.

"Finally, we have a class named 'Bling' which needs to have a property called 'ruby'. Switch over to 'Bling.h' and add a property named 'ruby' that belongs to the class 'Ruby'."

To which I would answer in Bling.h:

@property(nonatomic) Ruby *ruby;

However, that only returns: "Bummer! Remember, 'ruby' should be a "nonatomic" property." I have also tried completely interfacing it as the Bling class:

@interface Bling : Ruby
@property(nonatomic) Ruby *ruby;
@end

But that doesn't work either, and the question only asks for us to add the ruby property.

Any help at all would be appreciated. Thanks!

8 Answers

I got same error but when I add strong param too, it worked

@property(nonatomic, strong) Ruby *ruby;

That's weird, because I actually tried it with that exact syntax and it didn't work... I'll try it now. Thanks!

I'm getting the same error, I assume its an error on their side :S

Awesome, thanks for the confirmation! I guess we'll just wait for a fix :)

Was nonatomic and/or strong ever discussed as what those are and why they are there/when they are used? If so, could you point me to the video? I never saw it.

nope, me neither.

any one got this?

solve it , this is the solution for task 3 :

#import “Ruby.h”

@interface Bling : NSObject
@property (nonatomic,strong) Ruby * ruby;
@end

Just been going through this task today and was working through my errors. This was helpful but to avoid any confusion, if you include the #import "Ruby.h" element it will fail in the compiler.

Meshal,

Instead of using #import "Ruby.h" at the top of the Bling class, wouldn't the code below be an alternate solution?

@interface Bling : NSObject @class Ruby;

@property (nonatomic,strong) Ruby * ruby; @end

Note: How do you insert the black background when trying to show code in a forum post?

you can see the markdown cheetsheet team tree house provided here https://teamtreehouse.com/forum/code-challenge-inheritance#

Code Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

Okay great, thanks!