January 2022
Beginner to intermediate
416 pages
10h 21m
English
This chapter will show you techniques for managing any number of objects instantiated from the same class. I’ll first go through an OOP implementation of the bank account example from Chapter 1. The OOP approach allows the data and code of an account to be at the same level, eliminating the need to depend on global data. Then, I’ll split the program into main code that provides a top-level menu and a separate Bank object that manages accounts, in addition to any number of Account objects. We’ll also discuss a better way of handling errors using exceptions.
Our bank account class will need, at ...
Read now
Unlock full access