Additional Attribute of Classes Withdrawal and Deposit

Derived classes BalanceInquiry, Withdrawal and Deposit inherit attribute accountNumber from base class Transaction, but classes Withdrawal and Deposit contain the additional attribute amount that distinguishes them from class BalanceInquiry. Classes Withdrawal and Deposit require this additional attribute to store the amount of money that the user wishes to withdraw or deposit. Class BalanceInquiry has no need for such an attribute and requires only an account number to execute. Even though two of the three Transaction derived classes share this attribute, we do not place it in base class Transaction—we place only features common to all the derived classes in the base class, so derived classes ...

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.