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 trial

C# C# Objects Methods Method Overloading

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

I don't know what I'm doing wrong

I did what it asked but it gives me this error: Frog.cs(17,24): error CS1519: Unexpected symbol (' in class, struct, or interface member declaration Frog.cs(17,37): error CS1519: Unexpected symbol)' in class, struct, or interface member declaration Frog.cs(18,8): error CS9010: Primary constructor body is not allowed Compilation failed: 3 error(s), 0 warnings

Frog.cs
namespace Treehouse.CodeChallenges
{
    class Frog
    {
        public readonly int TongueLength;

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }

        public bool EatFly(int distanceToFly)
        {
            return TongueLength >= distanceToFly;
        }

       public readonly (ReactionTime);
       {


       }




    }
}

2 Answers

Steven Parker
Steven Parker
229,644 Points

The instructions ask you to "Add another public readonly integer field", but the code added here looks like a cross between the syntax for a field and for a new method.

Try using the existing field "TongueLength" on line 5 as a model, and create a line that looks like that except for the name.