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 trialDiwakar Singh
1,450 Pointswhat is wrong with my code
setter and getter
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _numFilesEaten;
public int GetNumFileEaten()
{
return _numFilesEaten;
}
public void SetNumFilesEaten( int numFilesEaten)
{
_numFilesEaten=numFilesEaten;
}
}
}
1 Answer
andren
28,558 PointsThe structure of your code is fine, but your names are off.
You have named the backing field _numFilesEaten instead of _numFliesEaten (Files instead of Flies), and your getter and setter have similar naming problems.
If you correct all of the names like this:
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _numFliesEaten;
public int GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten(int numFliesEaten)
{
_numFliesEaten = numFliesEaten;
}
}
}
Then your code will pass.