C++ Concept Map

Visibility

A simple metaphor that helps understand the principle of scope is to imagine that a wall exists around each region of scope, and to consider what names one can see through the walls when standing inside the region - in other words which names are visible.

Scope regions may be nested inside each other, and rules govern what is visible and what is not. In general, a name may be seen if it is outside the walls, but it is not possible to see inside another set of walls. In the diagram below, the four kinds of scope are shown by example.


Please mail any corrections and/or suggestions to Roger Hartley at
rth@cs.nmsu.edu

Copyright © 2003 Roger Hartley