23.4.8. Class Transaction
Transaction (Figs. 23.28–23.29) is an abstract base class that represents the notion of an ATM transaction. It contains the common features of derived classes
Deposit. Figure 23.28 expands upon the
Transaction header file first developed in Section 23.3. Lines 13, 17–19 and 22 contain function prototypes for the class’s constructor and four member functions, which we discuss shortly. Line 15 defines a virtual destructor with an empty body—this makes all derived-class destructors
virtual (even those defined implicitly by the compiler) and ensures that dynamically allocated derived-class objects get destroyed properly when they are deleted via a base-class pointer. Lines 24–26 declare ...