Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

15.2 Overview

The video store needs to print mailing labels for all its customers. To accomplish this, two classes are used: VVContact and VVContactRepository.

The first class, VVContact, encapsulates one database record. In other words, each instance of the class VVContact represents one customer. Why wasn't the class named VVCustomer instead? Because this class will be reused later for something other than customers. VVContact consists of seven components that represent the various fields important for storing customer information, such as name, ID number, address, and so on. In addition to the data, there are several member functions that carry out actions associated with customers. The important member function for this tutorial is called mailingLabel(). An instance of VVContact, when given an appropriate output stream, is able to print a mailing label for itself.

The second class, VVContactRepository, encapsulates the set of all customers in the database. Through an instance of this class, all customer records in the database can be manipulated at one time. A VVContactRepository instance consists of references to the database and the table in which the customer data resides. This class also includes a number of member functions to assist in manipulating the set of all customer records.

Most of the functionality used in this example is encapsulated in these two classes. These classes hide the details of the DBTools.h++ code in the same manner that the DBTools.h++ code hides the details of the underlying database API.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.