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 Inheritance Inheritance

I cannot figure out how to create a new .cs file here to make the sub class of the Polygon class.

I am trying to make the sub class called Square with the base class named Polygon. Polygon is already populated, however, I cannot find any place to make a new .cs file to create the sub class.

namespace Treehouse.CodeChallenges
    class Polygon
        public readonly int NumSides;

        public Polygon(int numSides)
            numSides = 4;
            NumSides = numSides;

2 Answers

Steven Parker
Steven Parker
229,788 Points

In actual practice, you might choose to place the classes in separate files, but it would also be a good strategy to group all the "Polygon" sub-classes together in the same file as the parent class.

For the challenge, you can create the new class in the same file, and within the same namespace.

Thank you, luckily I was able to figure this one out already, however, I do appreciate the feedback. Thank you!