Skip to main content

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:

PhoneNumber should contain the following two properties:

Property Name Type Parameters
Type %String VALUELIST=,Business,Home,Mobile,Fax
Number %String

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 %PersistentOpens in a new tab. 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 %SerialObjectOpens in a new tab rather than %PersistentOpens in a new tab.

FeedbackOpens in a new tab