Prev | Current Page 70 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

If the main function is missing from your application
hierarchy, your code cannot be compiled as a runnable program, but will still be accessible by other
applications that load the compiled files as a module.
The main function can exist among your larger application framework or separately in a class of its own.
Very often, you will create a pilot class that will function as the primary messaging center of your
application and will include a static main function for initialization. Other times, however, you may
prefer to abstract this function. Regardless of which route you choose, a runnable application will always
require a starting class, even if that class will not be instantiated.
Class instantiation is part of object - oriented programming methodologies. While you can use haXe
without constructing all of your code as objects, you will still be required to structure your code within
class blocks:
class MyClass
{
....
}
Even a program contained in a single file will need at least one class block to contain the various
functions that make up the application.


Pages:
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82