www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 520]

Answers to Self-Review Exercises

9.1

a) dot (.), arrow (->). b) private. c) public. d) Default memberwise assignment (performed by the assignment operator).

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: Members cannot be explicitly initialized in the class definition.

    Correction: Remove the explicit initialization from the class definition and initialize the data members in a constructor.

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

    Correction: Remove the return type int from the declaration.


Previous Page
Next Page