Fix C++ namespace explanation

This commit is contained in:
Geoff Liu 2015-08-28 11:48:38 -06:00
parent 55735f8b6c
commit 97b97408ea

View File

@ -158,11 +158,12 @@ void foo()
int main() int main()
{ {
// Assume everything is from the namespace "Second" // Includes all symbols from `namesapce Second` into the current scope. Note
// unless otherwise specified. // that simply `foo()` no longer works, since it is now ambiguous whether
// we're calling the `foo` in `namespace Second` or the top level.
using namespace Second; using namespace Second;
foo(); // prints "This is Second::foo" Second::foo(); // prints "This is Second::foo"
First::Nested::foo(); // prints "This is First::Nested::foo" First::Nested::foo(); // prints "This is First::Nested::foo"
::foo(); // prints "This is global foo" ::foo(); // prints "This is global foo"
} }