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 trialTomas Baca
3,578 PointsCode challenge error
namespace Treehouse.CodeChallenges { class Frog { public readonly int TongueLength;
Frog(int TongueLength)
{
}
}
}
Tomas Baca
3,578 PointsCode challenge ask me to Add a constructor to the Frog class that accepts a tongue length parameter value.
Tomas Baca
3,578 Points3 Answers
Daniel Hildreth
16,170 PointsThis is the syntax you're supposed to have.
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
}
}
You instantiate the tongueLength method variable and then assign it to the TongueLength instant variable declared at the top. Hope this helps you.
Tomas Baca
3,578 PointsDaniel Hildreth
16,170 PointsBelieve you need to instantiate it as such:
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int TongueLength)
{
TongueLength tongueLength = new TongueLength();
}
}
}
Are you able to send me a link to the challenge so I can see the question and how they set it up?
Daniel Hildreth
16,170 PointsDaniel Hildreth
16,170 PointsWhat is the problem you're trying to solve here?