CSet:new
The new method creates an instance of the CSet class. Note that the object can also be created using new_set.
Note: This method's name uses all lower case to present it as the analog of the C++ new operator. Generally, the names of class methods begin with an uppercase letter but new and delete are different.
S = CSet:new()
Default constructor. The new CSet S has no elements.
S = CSet:new( CSet_old )
This is a copy constructor. The new CSet S is initialized to the members of the CSet_old argument.
The following example shows the use of a default constructor and destructor pair:
|
-- create a new instance of S of the CSet class. |
|
-- other uses of the class go here, between new and delete. |
|
-- deletes the object and its associated memory. |
The next example shows the use of both types of constructors:
|
-- initialization constructor |
|
-- add a member |
|
-- add a member |
|
-- add a member |
|
-- result: Count = 3 |
|
-- copy constructor |
|
-- result: Count = 3 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.