previous | start | next

## Nested Classes and Name Spaces

- Name spaces are also used to avoid naming conflicts.
- By using name spaces, it becomes possible to use classes or functions with the same name in the same program.

  >     std::map /* standard library template map */
  >     acme::map /* another class called map */

- To add classes, functions, or variables to a name space, surround their declarations with a `namespace` block.

  >     namespace acme
  >     {
  >        class map
  >        {
  >           ...
  >        };

  >        void draw(map m);
  >     }

- Namespaces are open - you can add as many items to a namespace as you like by starting another `namespace` block.

  >     namespace acme
  >     {
  >        class maze
  >        {
  >           ...
  >        }
  >     };

previous | start | next