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 trialroseleen zhou
2,321 Pointsaccessor methods task 2 of 2
write a public getter method named GetNumFliesEaten and a public setter method named SetNumFliesEaten for _numFliesEaten.
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _NumFliesEaten;
public int GetNumFliesEaten()
}
return _numFliesEaten;
}
public void SetNumFliesEaten(int x)
{
_numFliesEaten = x;
}
}
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! I received your request for assistance. You have several things going on here which are causing errors.
- your private field should be
_numFliesEaten
and not_NumFliesEaten
. Note the capitalization. - your curly braces are off in the
GetFliesEaten
the closing curly brace on the following line should be an open curly brace - you are missing a closing curly brace at the end of the file
When I correct these, your code passes. Hope this helps!
roseleen zhou
2,321 Pointsthanks it worked