20.5.  Review Questions

[ fromfile: scopestorage-questions.xml id: questions-scopestorage ]

  1. What is a scope? What kinds of "things" have a scope?

  2. What is a storage class? What kinds of "things" have a storage class?

  3. When are static objects initialized? Be sure to consider both globals and block scope objects.

  4. How does const act as a scope modifier?

  5. What does extern mean?

  6. The keyword static has many meanings depending on where it is used.

    1. Explain how static can be used as a scope modifier.

    2. Explain how static can be used as a storage-class modifier.

    3. Give another use for the keyword static.

  7. What is the storage class of an object defined in a namespace?

  8. What is special about a pointer to an object declared using the keyword register?

  9. What is the difference between a class and a namespace?

  10. What must you do if you want to declare an object in the header file of a namespace without defining it?