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 trialLuis Santos
3,566 PointsI need help with the second part of this challenge.
I understood the "getter" and "setter" method at large, yet I feel there is something missing. Can anyone please point what it is I am doing wrong, the help will be greatly appreciated. Thank you.
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _numFliesEaten;
}
public GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten( _numFliesEaten value)
{
_numFliesEaten = value
}
}
1 Answer
Steven Parker
231,198 PointsIt looks like you have a few issues:
- You declared your methods outside of the Frog class - they need to be declared inside it.
- You forgot to declare the return type of GetNumFliesEaten
- You declared value as a type _numFliesEaten, but that's a property not a type (it's type is int)
- You forgot the semicolon after "
_numFliesEaten = value
"