When writing a simple program that only uses one class, is it better to put all the working code in main(), or is it better to put all the working code in the constructor, and have main simply instantiate the class? Example:
In general, a constructor gets an instance of the class ready to do whatever it's going to do. Actually "doing" something -- the "working code" -- should be deferred to a method executed after the instance is fully constructed.
So I'm inclined towards something like...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Jan 24, 2010
Thanks Marc. This answers my question. What you are suggesting sits better with me than the either of the two options I originally presented.