23.4.3. Class Keypad

Class Keypad (Figs. 23.1823.19) represents the keypad of the ATM and is responsible for receiving all user input. Recall that we are simulating this hardware, so we use the computer’s keyboard to approximate the keypad. A computer keyboard contains many keys not found on the ATM’s keypad. However, we assume that the user presses only the keys on the computer keyboard that also appear on the keypad—the keys numbered 0–9 and the Enter key. Line 9 of Fig. 23.18 contains the function prototype for class Keypad’s one member function getInput. This member function is declared const because it does not change the object.

 1   // Keypad.h 2   // Keypad class definition. Represents the keypad of the ...

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.