This is a discussion on Convert Java To C++ within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by laserlight at least until you become a Roman citizen and can get away with acting like you ...
Anyone may do as they are so enclined insofar as using either a main function directly or else by way of some class. Both surely have their own merits and disadvantages, but neither is "wrong", "incorrect", or "bad style". It's all just a matter of preference.
No, it doesn't depend. It's not part of a class. It's the entry point to every C++ program. That's all. There are no split hairs. It is always there. It's not part of a class. Period.
You didn't say "I make a class that I call from main and have it be the starting point for the remainder of my program."
Hope is the first step on the road to disappointment.
I can see where you are coming from, but consider GReaper's confusion expressed in post #9 that required clarifications from various people, including yourself. To be fair, quzah's statement was inaccurate too: a function named main can indeed be a member of a class; but the global main function cannot be a member of a class.Originally Posted by gardhr
If "acting like a Greek" means being creative and open-minded, sure, I'll go with that. I don't prescribe to anything more than safe, intelligent coding practices. It that's a crime (and in Rome, everything seems to be), so be it. As they say, "I'll follow the Sun".
That isn't actually an advantage, and there would not necessarily be a "useless integer" passed with what I stated as more common in post #10.Originally Posted by gardhr
I don't see how it is "a needlessly redundant artifice" to begin with.Originally Posted by gardhr
You did not state the details earlier, so that was not clear, though I understood that you were not saying that there would not be a global main function at all. However, to someone with less knowledge of C++, it would and did seem that you were saying that there would not be a global main function. That's unfortunate, but having been clarified, so be it.Originally Posted by gardhr
What exactly do you mean by this? I understand it to mean that you define the main function in a header file that is included in exactly one source file.Originally Posted by gardhr