<<< Separating declarations and definitions | Index | Other things possible within scope >>> |
C++ variables, functions, and classes are placed in a scope.
Scope determines visibility and lifetime of a variable.
C comes with:
global scope outside functions (global namespace)
local scope inside functions
code blocks also have their own scope.
In C++, classes provide a scope nested inside the global scope.
Class scopes can be referred to by name using the :: operator.
Member functions themselves are in the class scope.
Member function bodies have the local scope.
<<< Separating declarations and definitions | Index | Other things possible within scope >>> |