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 Object Initialization

Objects and Constructor clarification.

For constructor methods, is it possible to create a new instance of an object in a class other than the Main() class and will still call the constructor and set all of its fields and such?

1 Answer

Yes, you can create objects from other classes than just the Main class. They will follow the same rules if you created a constructor for those objects. Classes can be as many levels deep as needed. The Main class is needed to get things started, after that you may need another class to do all of the work.