Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition
by Paul J. Deitel - Deitel & Associates, Inc., Harvey M. Deitel - Deitel & Associates, Inc.
J.8. Class BankDatabase
Class BankDatabase (Fig. J.7) models the bank’s database with which the ATM interacts to access and modify a user’s account information. We determine one reference-type attribute for class BankDatabase based on its composition relationship with class Account. Recall from Fig. 11.19 that a BankDatabase is composed of zero or more objects of class Account. Line 4 implements attribute accounts—an array that will store Account objects—to implement this composition relationship. Class BankDatabase has a parameterless constructor (lines 7–13) that initializes accounts with new Account objects. We create two new Account objects with test data and place them in the array (lines 11–12). Note that the Account constructor has four ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access