Answers to Self-Review Exercises

  1. 9.1

    1. dot (.), arrow (->).

    2. private.

    3. public.

    4. Default memberwise assignment (performed by the assignment operator).

    5. friend.

    6. initialized.

    7. static.

    8. this.

    9. const.

    10. default constructor.

    11. non-static.

    12. before.

    13. :: scope resolution operator.

  2. 9.2

    1. Error: Destructors are not allowed to return values (or even specify a return type) or take arguments.

      Correction: Remove the return type void and the parameter int from the declaration.

    2. Error: Constructors are not allowed to return values.

      Correction: Remove the return type int from the declaration.

    3. Error: The class definition for Example has two errors. The first occurs in function getIncrementedData. The function is declared const, but it modifies the object.

      Correction: To correct ...

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.