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 trialAmar Resic
2,922 PointsGetter and Setter Coding Challenge Help
I didn't feel like there was enough info for this question. I tried so many different combinations and looked at the example. My error is saying did you set _numFliesEaten in the setter and return _numFliesEaten in the Getter. What value am I supposed to set _numFliesEaten to in the setter. Everything I try doesn't work.
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _numFliesEaten;
public int GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten(int _numFliesEaten)
{
}
}
}
1 Answer
Steven Parker
231,269 PointsYou're close, but there's a few issues yet:
- the setter is missing the body code that would copy the argument into the field
- the setter code will be easier to write if the parameter name is different from the field name