Skip to main content

Adding Properties to the CInfo.Address Class

Next, we will add some properties to the CInfo.Address class. We will add three properties: City, State, Zip. All of these are simple string properties.

Add these three properties, using either the New Property Wizard (click Class->Add->Property); or by simply adding the property definitions to the class definition using the Studio editor. Your class should now look like this:

Class CInfo.Address Extends (
        %SerialObject, 
        %Populate, 
        %XML.Adaptor
        )
{

Property City As %String(POPSPEC = "City()");
Property State As %String(POPSPEC = "USState()");
Property Zip As %String(POPSPEC = "USZip()");

}

Note that all three of these properties are of type %StringOpens in a new tab and that they each define a POPSPEC parameter. The POPSPEC parameter helps the %PopulateOpens in a new tab class determine how to generate random data for a given property. You do not need to include this parameter, but your sample data will be more interesting if you do.

Compile this class, using the Compile command within the Build menu.

FeedbackOpens in a new tab