Namespaces Quiz
Below are the answers to the Namespaces Quiz, along with a brief discussion.
1. False. They don’t make inaccessible code accessible (which must be done with assembly references, covered later) but rather, make any already accessible type available without needing to use fully qualified names. This is equivalent to import
statements in Java. This is an entirely different mechanism than #include
statements in C++.
2. True. (As described in #1.)
3. True. However, they are not allowed to have the same name and be in the same namespace.
4. True. If two types have the same name, and they are both in namespaces that have been brought in with using directives, this results in a name collision.
5. You can use fully qualified names throughout your type (file) to distinguish between them, or use aliases to give alternative names to them. (The alias can be the same name as the original name, which is a viable choice if you only ever care to use one of the two.)