Is it good practice to do all instantiation inside the Main() method and not in any other classes?

Recommended Answers

All 3 Replies

I would do instantiation when it is needed, be it in the Main method or not.

Thats what I thought...but I was told the other day to use the Main() method as the driver of the program...and instantiate in Main();

Main() is just what is called the entrypoint of your program. It is there where the first instructions of your program will be executed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.