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 trialPontus Hagman
1,120 PointsGetting CS1519 errors when compiling can't figure out why.
Errors:
Frog.cs(5,48): error CS1519: Unexpected symbol _numFliesEaten' in class, struct, or interface member declaration
Frog.cs(5,49): error CS1519: Unexpected symbol
;' in class, struct, or interface member declaration
Help would be much appreciated.
namespace Treehouse.CodeChallenges
{
class Frog
{
private int NumFliesEaten _numFliesEaten;
public NumFliesEaten GetNumFliesEaten()
{
return _numFliesEaten;
}
public void SetNumFliesEaten(NumFliesEaten value)
{
_numFliesEaten = value;
}
}
}
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! In the first step you were supposed to rename NumFliesEaten
to _numFliesEaten
, but you kept both names. The variable should only have one name:
private int _numFliesEaten;
This is just a regular integer data type. Nothing fancy. So your GetNumFliesEaten()
method should have a return type of int
and your SetNumFliesEaten
should still have a return type of void, but it should accept an int
. Right now, you have GetNumFliesEaten with a return type of NumFliesEaten
(which doesn't exist) and your SetNumFliesEate
accepts a data type of NumFliesEaten
.
Making these corrections should get you through the first step. Hope this helps!
Pontus Hagman
1,120 PointsThanks for the help!