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 Object-Oriented Programming Initialization

Matthew Tyler
Matthew Tyler
653 Points

ive watched the last video about 3 times now. i still dont know how to do this

I'm meant to "Use the constructor to initialize the TongueLength field to the value passed in." but I have absolutely no idea

Frog.cs
namespace Treehouse.CodeChallenges
{
    class Frog
    {
        readonly public int TongueLength;
        public Frog (int length)
        {
            TongueLength = length;
        }
    }
}

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Matthew Tyler! I think we're going to have to agree to disagree here because it looks to me like you know exactly what you're doing. In fact, when I copy/paste your code into the challenge it passes all steps, which begs the question why it's not passing for you. My best guess is that there is some kind of caching problem here (either client-side or server-side) that is causing the issue. I might suggest clearing your browser cache, shutting down the browser, you might have to even log out of Treehouse and log back in (in case it's cached server-side) because your code straight-up passes!

Hope you get this sorted! :sparkles:

Matthew Tyler
Matthew Tyler
653 Points

oh, that's strange, i tried putting that in and it didnt work, but it does now, sorry to bother you!