Answers to Self-Review Exercises

  1. 3.1

    1. class.

    2. .h.

    3. type, name.

    4. data member.

    5. access specifier.

    6. void.

    7. getline.

    8. #include.

  2. 3.2

    1. False. Function names begin with a lowercase letter and all subsequent words in the name begin with a capital letter.

    2. True.

    3. True.

    4. False. Such variables are local variables and can be used only in the member function in which they’re declared.

    5. True.

    6. True.

  3. 3.3 A local variable is declared in the body of a function and can be used only from its declaration to the closing brace of the block in which it’s declared. A data member is declared in a class, but not in the body of any of the class’s member functions. Every object of a class has each of the class’s data members. Data members are accessible to all member functions ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.