@@ -0,0 +1,31 @@
|
||||
# Imports
|
||||
The import statement allows one module access to the public declarations of another module.
|
||||
|
||||
## Syntax
|
||||
The import statement uses the following syntax:
|
||||
|
||||
```c2
|
||||
import module_name;
|
||||
```
|
||||
|
||||
They can optionally be prefixed by the `public` keyword, in which case the module will
|
||||
export everything in the import transitively.
|
||||
|
||||
For instance,
|
||||
|
||||
```c2
|
||||
--- a.c2
|
||||
module a;
|
||||
import b;
|
||||
|
||||
--- b.c2
|
||||
module b;
|
||||
public import c;
|
||||
|
||||
--- c.c2
|
||||
module c;
|
||||
|
||||
// Some declarations
|
||||
```
|
||||
|
||||
In this example, both module a and b can access the declarations in module c.
|
||||
Reference in New Issue
Block a user