Why us Why do we need to?
For a class method that makes sense, we must have an instance of the object. When main
is called, we have no instance.
So a static member function could be made instead, but what's the point? Is this "more object oriented"? How it is?
I think it makes sense, as C ++ does: main
is where you start, before you have any objects, before any instances exist.
In Java, main
is a static member because nothing exists. But in C ++, there are non-member functions, so why not let main
be one of them?
source share