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
        }
    }
}
HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

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;

        }
    }
}
Andrew Day
Andrew Day
1,389 Points

complete code is below

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

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }
    }
}
Brianna Ingram
Brianna Ingram
642 Points

Thank you very much.

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

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;
        }
    }



}
Cedric Phizeme
PLUS
Cedric Phizeme
Courses Plus Student 956 Points

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

Elfar Oliver
Elfar Oliver
3,924 Points

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

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

here is how i did it

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

}

} }

HIDAYATULLAH ARGHANDABI
HIDAYATULLAH ARGHANDABI
21,058 Points

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

    public Frog(int tongueLength) 
    {

        TongueLength = tongueLength;

    }
}

}```

Andrew Day
Andrew Day
1,389 Points

put public and check your spelling