Beginning with a Simple Base Class

When one class inherits from another, the original class is called a base class and the inheriting class is called a derived class. So, to illustrate inheritance, we need to begin with a base class. Fortunately, the Pontoon National Bank needs a class to represent its basic checking plan, the Brass Account. Listing 12.1 shows a header for a streamlined BankAccount class meeting this need. It has data members representing a client's name, account number, and balance. It has methods for creating an account, making deposits, making withdrawals, and displaying account data. The class falls short of representing a real bank account, but it has enough features to satisfy the imaginary Pontoon National Bank and to ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.