Create Methods for a User Class
The data type of an attribute or method can be either a simple data type or a class, including another user class. If a user class is defined as the data type, the user class must exist before you create the attribute or method.
You can create a method for a user class using the Class Editor.
When you define methods for a user class, you specify:
• The name by which they are invoked
• A data type for the return value (can be nullable)
• A remark describing the attribute
To create a method for a user class
1. Select the application that contains the user class in the Applications portlet of the Develop tab.
2. Double-click the user class in the Components portlet.
The Class Editor is opened.
3. Click the Methods tab in the Class Editor.
4. Click Edit, Insert, New.
The Create Method dialog appears.
5. Enter a name for the method in the Name field (for example, my_method).
6. Select the Private (Encapsulation) option if you want to specify this method as private, meaning that the method is only accessible to this user class and its subclasses.
7. Specify the return value for the method.
8. Click Create.
The dialog changes to the MethodProperties dialog.
Like the AttributeProperties dialog, this dialog lets you specify or edit a method's properties if you did not do so previously.
Note: You can click the New button to access the Create Method dialog again to create additional methods.
9. Define any other property settings.
10. Click Close.
Workbench displays the method on the Methods tab of the Class Editor.
11. Click File, Save and Close to save your changes to the user class.