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 Methods

John MacLeod
John MacLeod
903 Points

Method is not recognized

I created the bool method EatFly, but it is not being recognized.

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

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

         bool EatFly(int distanceToFly);
        {

        }
    }
}
nick smyth
nick smyth
3,430 Points

maybe try to make the EatFly class public

1 Answer

Steven Parker
Steven Parker
231,248 Points

The instructions said, "It should return true if the frog can reach the fly with its tongue, and false otherwise.". So you still need to implement the body of the function so it will return the correct result.

Also, there is a stray semicolon at the end of the line defining the method; and the method should be declared "public" as nick suggested.