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

What's wrong with my answer to create an empty class called Frog? namespace Treehouse.CodeChallenges

namespace Treehouse.CodeChallenges {

class Frog 
{
}    

class Program
{
    static void Main()
    {            
        Frog frog = new Frog();
    }
}

}

Program.cs
namespace Treehouse.CodeChallenges
{

    class Frog 
    {
    }    

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

1 Answer

The challenge wanted you to put the empty Frog class in the Frog.cs file, not the file that has the Program class.

Above the code editing area you should see two tabs, click the one that is called Frog.cs and put the empty Frog class there instead.

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

Good luck! ~alex