C# C# Objects Object-Oriented Programming Initialization

runley
runley
618 Points

c# objects course, need help asap

during this task: Add a constructor to the Frog class that accepts a tongue length parameter value.

I get this error:

Frog.cs(7,40): error CS1001: Unexpected symbol `)', expecting identifier Frog.cs(7,16): error CS1520: Class, struct, or interface method must have a return type Compilation failed: 2 error(s), 0 warnings when running this code, someone help

my code is bellow

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

        public TongueLength(tongueLength)
        {
            TongueLength = tongueLength;
        }
    }
}
Shadab Khan
Shadab Khan
5,213 Points

Hi Runley,

I see your class name (Frog) is different from your constructor name (TongueLength), which isn't allowed. Your class name must be the same as the constructor.

Secondly, you're also missing the type of the parameter you're passing to the class constructor, i.e. it just can't be tongueLength; you need to tell exactly what type the parameter is e.g. int tongueLength

Your code should look like below:

class Frog
    {
        public readonly int TongueLength;

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

All the best and happy coding! :)