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

Not sure what is being asked here

Please advise

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 int ReactionTime;
        public readonly int ReactionTime2;

        public reactionTime(int ReactionTime, int ReactionTime2)
        {
            ReactionTime = reactionTime;
            ReactionTime2 = reactionTime2;

        }





    }
}
Austin Betzer
Austin Betzer
2,747 Points

You just need to make the Reaction time private field and then assign the filed to the property.

    public readonly int TongueLength;
    // Add the Field
    public readonly int ReactionTime;

    public Frog(int tongueLength, int reactionTime)
    {
        TongueLength = tongueLength;
        // assign it
        ReactionTime = reactionTime;
    }

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

2 Answers

Steven Parker
Steven Parker
231,236 Points

You only need one "ReactionTime" field.

And since the name of the class is "Frog", the constructor method is also named "Frog". It is that method that the instructions are telling you to add the second parameter to.

Thank you very much