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 trialMatthew Corby
2,685 PointsShape and Circle program compile results not what they should be
When I build, compile and run the example program we walk through in this lesson, my Circle area comes up as -1.000000 the same as the Shape area. All my code (Shape.h, Shape.m, Circle.h, Circle.m) is exactly the same as the instructors. I have made sure to go over it several times and yet I still don't get the results that show up for the instructor. Can someone please tell me what is going on?
2 Answers
Tom Holland
24,288 PointsThe problem is on line 5 of Circle.m
Your method is named -(float)radius when it should be -(float)area.
Matthew Corby
2,685 PointsTom you're absolutely right! Thank you! I knew it was something simple that I was missing. Appreciate it!
Tom Holland
24,288 PointsIt's always something! Glad I could help.
Matthew Corby
2,685 PointsMatthew Corby
2,685 PointsHere is my main:
Here is my Shape.m:
Here is my Shape.h:
Here is my Circle.m:
Here is my Circle.h:
Hope all of that helps. I'm running Xcode 6.1 as well. Thanks!