mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 15:24:09 +03:00
Fix C++ namespace explanation
This commit is contained in:
parent
55735f8b6c
commit
97b97408ea
@ -158,11 +158,12 @@ void foo()
|
||||
|
||||
int main()
|
||||
{
|
||||
// Assume everything is from the namespace "Second"
|
||||
// unless otherwise specified.
|
||||
// Includes all symbols from `namesapce Second` into the current scope. Note
|
||||
// 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;
|
||||
|
||||
foo(); // prints "This is Second::foo"
|
||||
Second::foo(); // prints "This is Second::foo"
|
||||
First::Nested::foo(); // prints "This is First::Nested::foo"
|
||||
::foo(); // prints "This is global foo"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user