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
mads johansen
547 Pointserror message!
Shape *shape = [[shape alloc]init] i get an error message when i type in this code. no visible @interface for 'shape' declares the selector 'alloc' any i ideas what i did wrong?
2 Answers
Gabe Nadel
Treehouse Guest TeacherThis line:
Shape *shape = [[shape alloc]init]
should read:
Shape *shape = [[Shape alloc]init];
Remember, we are saying: create an instance of the CLASS Shape, called "shape". So, on the right side of the equal sign we need to call alloc on Shape, not shape. Since we haven't actually created the instance yet - since that is what this line does - the compiler doesn't even know what "shape" is yet.
mads johansen
547 Pointsit worked, thank you very much! :)