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 trialAndras Andras
8,230 PointsClass, struct, or interface method must have a return type
Hi Sorry, I need help for the following code, I tried to put everything in but still have error message.
namespace Treehouse.CodeChallenges
{
class Frog
{
private int _numFliesEaten;
public GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten()
{
_numFliesEaten = value;
}
}
}
1 Answer
Allan Clark
10,810 PointsJust from eyeballing it, looks like your GetNumFliesEaten() method needs to specify its return type (i.e. int). Also in the SetNumFliesEaten() method, there isn't a declared variable called 'value'. You will likely want that to come in as a parameter. SetNumFliesEaten(int value)