summaryrefslogtreecommitdiffhomepage
path: root/c++.html.markdown
diff options
context:
space:
mode:
authorBoris Verkhovskiy <boris.verk@gmail.com>2024-04-03 02:30:27 -0700
committerGitHub <noreply@github.com>2024-04-03 02:30:27 -0700
commit6d87022050ffbd5d818781427329c5362e3df197 (patch)
tree3809b2b1a7790d8b30e6d694c575eb68f02f661c /c++.html.markdown
parentc76b8f690a577d9ff89947d79c36a96a7c3b4deb (diff)
parente8dabf3c1955e1a458e8bc936587ad59772a9c33 (diff)
Merge branch 'master' into patch-1
Diffstat (limited to 'c++.html.markdown')
-rw-r--r--c++.html.markdown12
1 files changed, 9 insertions, 3 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 038c3900..499eb669 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -1,5 +1,5 @@
---
-language: c++
+language: C++
filename: learncpp.cpp
contributors:
- ["Steven Basart", "https://github.com/xksteven"]
@@ -158,6 +158,10 @@ namespace Second {
{
printf("This is Second::foo\n");
}
+ void bar()
+ {
+ printf("This is Second::bar\n");
+ }
}
void foo()
@@ -168,10 +172,12 @@ void foo()
int main()
{
// Includes all symbols from namespace 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.
+ // that while bar() works, simply using 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;
+ bar(); // prints "This is Second::bar"
Second::foo(); // prints "This is Second::foo"
First::Nested::foo(); // prints "This is First::Nested::foo"
::foo(); // prints "This is global foo"