It won’t work because on starting the program the 1st method to be executed is main()... but main is empty, a starting class is put in there which is your main program control object (class)does this answer the question
Sorry, it doesn't answer my question ahah. Main doesn't need an object to run the overall program, if this is what you are pointing to. Im wondering, why excactly you have to create objects on the heap only through static methods.
A static member function can access only other static members. They can access non-static members only through an instance of the class. I think this answers your question.
[tt]static void Main[/tt] is a special case, and is treated differently by the compiler. It just is being hosted by the enclosing class. Unless you create an instance of [tt]Program[/tt], your Document instance will never get created.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.