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#

Ray Karyshyn
Ray Karyshyn
13,443 Points

Classes in Different Files

So when we created an instance for the Tower class in Game.cs, why didn't we have to somehow include Tower.cs in Game.cs?

1 Answer

Steven Parker
Steven Parker
231,172 Points

They are included at build time.

When you build the project, you include all the individual source files either by name or by using a "wildcard" (like "*.cs"). And since the modules all share the same namespace, you don't need a "using" statement for them to reference each other.