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 trialAnthony Dowdell
1,880 PointsError implementing get set.
When implementing the get and set I keep getting the error:
Frog.cs(9,16): error CS1525: Unexpected symbol {'
Frog.cs(10,16): error CS1525: Unexpected symbol
{'
Compilation failed: 2 error(s), 0 warnings
The code itself reads:
public int NumFliesEaten { get {return _numFliesEaten;} set {_numFliesEaten = value;} }
the get is line 9 and the set line 10. I don't understand why I'm getting the error as this is what is displayed in the course as well as in Microsoft documentation. PLEASE HELP!!!
namespace Treehouse.CodeChallenges
{
public class Frog
{
private int _numFliesEaten;
public int NumFliesEaten()
{
get {return _numFliesEaten;}
set {_numFliesEaten = value;}
}
}
}
1 Answer
Anthony Dowdell
1,880 PointsJust as soon as I posted this, I realized the issue. It is the "()" after: public int NumFliesEaten