Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jonathan Barnthouse
2,801 PointsChallenge Task 1 of 1 Replace the accessor methods with a property named NumFliesEaten with a getter and setter for _nu
please help with "Bummer! Did you replace both accessor methods with a single property?"
I have no error messages when compiling, but need help, what I am I missing? Thanks!
namespace Treehouse.CodeChallenges
{
public class Frog
{
private int _numFliesEaten;
public int GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten(int x)
{
_numFliesEaten = x;
}
}
}

Jonathan Barnthouse
2,801 PointsWhat I am I missing Parker??
namespace Treehouse.CodeChallenges { public class Frog { private int _numFliesEaten;
public int NumFliesEaten
{
get
{
return _numFilesEaten;
}
set
{
_numFliesEaten = value;
}
}
}
2 Answers

Steven Parker
216,083 Points
That's much better! Now you only have a typo.
You wrote "_numFilesEaten
" instead of "_numFliesEaten
".
Other than that, looking good!

Jonathan Barnthouse
2,801 PointsThank you!

Sara Rena Anderson
15,044 Pointsnamespace Treehouse.CodeChallenges { public class Frog { private int _numFliesEaten;
public int NumFliesEaten
{
get
{
return _numFliesEaten;
}
set
{
_numFliesEaten = value;
}
}
} }
Steven Parker
216,083 PointsSteven Parker
216,083 PointsIt doesn't look like you've changed anything other than the name of the setter argument.
Remember, the object here is to replace both the getter and setter methods with a new property which handles the private field.
You might want to review the Properties video, and watch how the Location property is constructed for the Invader class.