Prev | Current Page 279 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The import action will only affect the code written after the
statement. The import declaration has this syntax:
import package.Type;
Where package is the name of the package that contains the desired type and Type is the name of the
file to import without extension; usually the filename corresponds to the main type defined in the file. Of
course, the package name can be omitted when importing types from the default empty package.
As many import statements may be included in the same file as they are needed. Note that it is not
possible to import whole packages but just one file at a time, importing the main type of each one.
Consider extending the Point class to Point3D . Usually this is done in a new file, but for the sake of
explanation, the definition will be added in the Point.hx file.
It is not possible to reference implicitly the Point3D class from outside the Point.hx file, because it is
not the main type of the file. To use this class, it is necessary to import all the type definitions included in
the Point.


Pages:
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291