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

Stephen Stewart
Stephen Stewart
5,727 Points

Kind of Stuck, I think i got this right but.. Not sure..

I though ti had this down to a T, however i can't seem to get past this bit, it keep coming up with an error...

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

        public int GetNumFliesEaten()
        {
            return _numFliesEaten;
        }

        public void SetNumFliesEaten(int value)
        {
            _numFliesEaten = value;
        }
     }
}

1 Answer

Steven Parker
Steven Parker
231,198 Points

It looks like your task 1 code got changed somehow as you added the code for task 2.

The name of the private field is correct, but instead of "GetNumFliesEaten", it should have a type of "int".

But all the code added for task 2 looks good. :+1: