Exercise: Creating the PhoneNumber Class
Now let's further enhance the application to include phone numbers for each contact. We will allow each contact to contain several phone numbers. As an exercise, create the application's PhoneNumber class. The class should be similar to Contact in that it meets the following requirements:
It belongs to the ContactDB package.
PhoneNumber should contain the following two properties:
After creating the class definition, click Build–>Compile to compile the class.
From the relational perspective, PhoneNumber like Contact has its own table. This is because it extends %Persistent. By contrast, Address does not have its own table. Its instances are stored in extra columns of the Contact table. This is because Address extends %SerialObject rather than %Persistent.