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 Encapsulation with Properties Accessor Methods

Furkan Demirkan
Furkan Demirkan
7,926 Points

I'm not sure what im doing wrong...[SOLVED]

I cant see what i missed...

Frog.cs
namespace Treehouse.CodeChallenges
{
    class Frog
    {
        private int _numFliesEaten;

        public GetNumFliesEaten(){
        return _numFliesEaten;
        }

        public void SetNumFliesEaten(int x){

        _numFliesEaten = x;
        }
    }
}

1 Answer

andren
andren
28,558 Points

You have forgotten to declare the return type of the GetNumFliesEaten method as string.

Furkan Demirkan
Furkan Demirkan
7,926 Points

Oh, I completely missed that I didn't have a return type. But I think you meant int. Thanks and kudos :)

andren
andren
28,558 Points

Yes I did meant int, sorry had a bit of a mental typo myself. Just goes to show how easy it is to overlook simple mistakes :)