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

Add a constructor to the Frog class that accepts a tongue length parameter value.

I need some help here...

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

        Frog (int TongueLenght)
        {
            tonguelenght = TongueLenght
        }
    }
}

correct this it will work try public Frog(int tongueLength) {

        TongueLength = tongueLength;

    }

10 Answers

Check the spelling on your tongueLength variables Make sure that you aren't missing any semi-colons.

Hi, I have similar issue. Not really sure what the error is here as it seems like its correct. No spelling or semicolon issues.

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

        Frog(int tongueLength) 
        {

            TongueLength = tongueLength;

        }
    }
}

complete code is below

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

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

Thank you very much.

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

    public Frog(int tongueLength) 
    {

        TongueLength = tongueLength;

    }
}

}

You didn't put public

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

The correct answer is:

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

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



}

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

This was actually right so this shouldn't have any downvotes. Copying that and pressing Enter and Tab just several times was easy. Thank you for the right answer

here is how i did it

namespace Treehouse.CodeChallenges { class Frog { public readonly int TongueLength; public Frog (int tongueLength) { TongueLength = tongueLength;

}

} }

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

    public Frog(int tongueLength) 
    {

        TongueLength = tongueLength;

    }
}

}```

put public and check your spelling

i think there is some indentation bug