Electrical and Computer Engineering
2 of 19
UAH
CPE 112
Scope of Identifiers
•Listing all of the places from which an identifier can be accessed legally is describing that identifier’s scope.
•C++ defines several categories of scope for any identifier
–Class scope. Postpone this until chapter 11.
–Local scope. The scope of an identifier declared inside a block extends from the point of declaration to the end of that block.
–Global scope. The scope of an identifier declared outside all functions and classes extends from the point of declaration to the end of the entire file containing the program code.