lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Namespaces.md (491B)


      1 +++
      2 title = 'Namespaces'
      3 +++
      4 # Namespaces
      5 Scopes: global, class, function, local, statement
      6 
      7 Namespaces help distinguish between identical variable names from different contexts.
      8 
      9 ## Using
     10 using declaration:
     11 
     12 - `using std::string` — “when I write string, I mean std::string”
     13 - specific to one function/class
     14 
     15 using directive:
     16 
     17 - `using namespace std` — “when you can’t find a name in this scope, look in std”
     18 - can be dangerous, you might not get what you’re looking for