Module
You will be briefly introduced to modules in this lesson.
We'll cover the following...
Module overview
The building blocks of D programs (and libraries) are modules.
D modules are based on a simple concept: Every source file is a module.
Accordingly, the single files that we have been writing for our programs have all been individual modules.
By default, the name of a module is the same as its filename without the .d
extension. When explicitly specified, the name of the module is defined by the module
keyword, which must appear as the first non-comment line in the source file.
For example, assuming that the name of a source file is “cat.d,” the name of the module would be specified by the module
keyword:
module cat;
class Cat {
// ...
}
The module line is optional if the module is not part ...