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

Chris M
Chris M
592 Points

Creating empty classes

Not sure I understand what to do here.

Program.cs
namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main()
        {            

        }
    }
}
Frog.cs
namespace Treehouse.CodeChallenges
{
}

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

Here you're asked to start out by declaring a class, We do this by going inside the namespace block and starting with the keyword class followed by the name of the class, Frog. Then we use two curly braces to mark the body, or block of the class where all the code for it will go later.

namespace Treehouse.CodeChallenges
{
    class Frog
    {
    }
}
Chris M
Chris M
592 Points

Whoops, was on task 2, the part after this. I should have stated that. In any case, I found an answer you gave to someone else. I didn't know they wanted you to make a variable and save the class to it. That didn't seem very clear to me.

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Seth Kroger is correct (as usual). However, it's important to note that this class must be put in the Frog.cs file and not the Program.cs file. :smiley:

In Frog.cs create an empty class named Frog inside the Treehouse.CodeChallenges namespace.

namespace Treehouse.CodeChallenges {

class Program
{
    static void Main()
    {            

            class Frog
                     {
                      }


    }
}

}

NOT WORKING /