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

Kyle Puckett
Kyle Puckett
2,488 Points

Trouble renaming private field

Having trouble making the NumFliesEaten field private and rename it to match the private field naming conventions used in this course.

Seems pretty straight forward but can't get it to compile..?

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

2 Answers

Steven Parker
Steven Parker
231,269 Points

You still have the old name there.

You added the new name following the private field convention, but you haven't removed the old name yet.

Kyle Puckett
Kyle Puckett
2,488 Points

Thanks for the response but I do not understand what you mean by "removed the old name?"

Steven Parker
Steven Parker
231,269 Points

In the current line, you have both the old name and the new name:

        private int NumFliesEaten _numFliesEaten;

But you only want the new name:

        private int _numFliesEaten;
Kyle Puckett
Kyle Puckett
2,488 Points

Ah, thank you so much!