C# C# Objects Object-Oriented Programming Initialization

Josh Lee
Josh Lee
4,118 Points

Not sure what I am doing wrong here...

When comparing to the code in the workspace for the video, this should be working. Not sure what I am doing wrong. I keep getting a compiler error.

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

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

    public static void Main()
    {
        Frog Frog = new Frog(8);
        int frogLength = Frog.TongueLength;
    }  
}

1 Answer

Steven Parker
Steven Parker
174,022 Points

You've done all the right things, but also some extras that are not part of the challenge instructions.

For this challenge, you only add to the class definition. You won't need to create a "Main" method or an instance of the class.

For best results with all the challenges, follow the instructions carefully but don't do anything extra!