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 Instantiation

Create a Frog instance in Program.Main() and assign it to a variable named mike.

i couldn't figure out this

Program.cs
namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {            
         Frog mike = new Frog(mike) ;
        }
    }
}
Frog.cs
namespace Treehouse.CodeChallenges
{
  class Frog
  {
    public string name;

    {name = name;}
  }
}

try with this,
Frog mike = new Frog(); it worked for me.

5 Answers

Seth Kroger
Seth Kroger
56,413 Points

The first part of the challenge is just to create an empty class named Frog, so it doesn't need any names or fields.

class Frog {}

Then when you're asked to create a new one, you make a new frog without passing any arguments like this:

Frog mike = new Frog();
//  or
var mike = new Frog();
Richard Wood
Richard Wood
1,990 Points

hmm. I had this exact answer typed but it didn't work.? Then I tried to copy & paste directly in. Still no good. I'm tempted to believe there may be some error?

namespace Treehouse.CodeChallenges { class Frog { } } ***Update* I just reset the code. It seemed to fix the problem.

I'm so sure that what im doing is correct but still having this problem. how to pass it!

also spaces do count so make sure just to leave one space at most otherwise the code will not work

Fradely Dilone
Fradely Dilone
24,037 Points

FROG.CS

namespace Treehouse.CodeChallenges { class Frog{

}

}

PROGRAM.CS

namespace Treehouse.CodeChallenges { class Program { static void Main() {
var mike = new Frog(); } } }