WITH ... ENDWITH Command Example

The following example creates a custom class name Employee. After the Employee class has been created with CREATEOBJECT( ), WITH ... ENDWITH is used to set multiple properties for the class. The properties values are then displayed.

moemployee = CREATEOBJECT('employee')

WITH moemployee
   .First_Name = 'John'
   .Last_Name = 'Smith'
   .Address = '16 Maple Lane'
   .HireDate = {^1998-02-16}
ENDWITH

CLEAR
? moemployee.First_Name + ' '
?? moemployee.Last_Name
? moemployee.Address
? moemployee.HireDate

DEFINE CLASS employee AS CUSTOM
      First_Name = SPACE(20)
      Last_Name = SPACE(20)
      Address = SPACE(30)
      HireDate = {  -  -  }
ENDDEFINE