create function
Syntax
create PKG_NAME[:SubpackageName[:SubpackageName]]{:ClassName([paramlist])
Description
Use the create function to instantiate an object of the specified application class.
Because the object’s constructor method is automatically invoked by the create function, any parameters needed by the constructor method must be included in the invocation of create.
Parameters
| Parameter | Description |
|---|---|
|
PKG_NAME |
Specify the name of the package that contains the class. |
|
:SubpackageName[:SubpackageName] |
Specify the subpackage path to the class. |
|
ClassName |
Specify the class that defines the object to be instantiated. |
|
paramlist |
Specify the parameters required by the object’s constructor method. |
Returns
An object of the specified application class.
Example 1
The following example simultaneously declares and instantiates a SearchFactory object:
import PT_SEARCH:SearchFactory;
Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory();
Example 2
In the following example, the constructor method of the Privilege class requires the list ID as an input parameter. Therefore, the parameter must be supplied in the invocation of create:
import PTAI_ACTION_ITEMS:*;
Component PTAI_ACTION_ITEMS:Privilege &privileges;
&privileges = create PTAI_ACTION_ITEMS:Privilege(&ListId);
----------------------------------------------------------
class Privilege
method Privilege(&newListId As string);
...
end-class;
Related Topics