I'm reading Programming Pragmatics and it mentions that:
C++ is representative of an increasingly common option, in which names are automatically exported, but are available on the outside only when qualified with the module name—unless they are explicitly “imported” by another scope (e.g., with the C++ using directive), at which point they are available unqualified.
I thought that all names in C++ are exported only when another module imports it.
If names of module A are automatically exported, why do we have to use #include in other modules? I thought the #include __ feature was similar to import __ in Python.
What is the syntax for qualifying the module name outside the module so that we can use its data without an explicit using directive?
Please enlighten me. Thank you very much in advance.
#include <string> std::string
versus#include <string> using namespace std; string
– Retired Ninja#include
has nothing to do with importing things across modules. – Remy Lebeau