www.gibmonks.com

Main Page




Previous Page
Next Page

[Page 569 (continued)]

Answers to Self-Review Exercises

10.1

a) member initializers. b) friend. c) new, pointer. d) initialized. e) static. f) this. g) const. h) default constructor. i) non-static. j) before. k) delete.

10.2

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 the first error, remove the const keyword from the definition of getIncrementedData.

Error: The second error occurs in function getCount. This function is declared static, so it is not allowed to access any non-static member of the class.

Correction: To correct the second error, remove the output line from the getCount definition.


Previous Page
Next Page