C# C# Objects Methods Methods

Angus Eliott
Angus Eliott
3,793 Points

How To Do this!

how do you do this! i'm completely stumped!

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

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }
        public EatFly (int distanceToFly, bool EatFly)
        {
            if (distanceToFly > 2)
            {
                bool EatFly = true;
            }
        }
    }
}

1 Answer

Steven Parker
Steven Parker
182,590 Points

It looks like you have the right basic idea, but have a few issues. Here's some hints:

  • the return type of a method should go in front of the method's name (not with the parameters)
  • the method has only one parameter
  • this method will need to compare the argument with the "TongueLength" variable
  • you'll need to return the result of the comparison
  • you'll want to compare only variables, no fixed values
  • not counting the parameter, you should not need to create any additional variables