LOTUSSCRIPT 言語
例 2 Dim xB As New Button("Merge", 60, 125)
xB は、Button という名前のクラスのオブジェクトを参照する値を持ったオブジェクト参照変数として宣言されます。新しい Button オブジェクトが作成されます。この例では、クラス Button のコンストラクタサブルーチンが 3 個の引数 (ボタンの名前、ボタンの位置を示す x 座標と y 座標) をとると想定します。(60, 125) の位置にある「Merge」という名前の新しいボタンが作成されます。このボタンへの参照が xB に代入されます。
例 3 ' Declare iVer and kVer as Integer variables.Note that ' the phrase As Integer must be repeated to declare both ' variables as Integer. Dim iVer As Integer, kVer As Integer ' Declare nVer as an Integer variable. ' The declared type of mVer is Variant, the default ' data type, because no data type is declared for mVer: ' there is no As type phrase for mVer, and no data type ' suffix attached to mVer. Dim mVer, nVer As Integer Print TypeName(mVer), TypeName(nVer%) ' Prints EMPTY INTEGER
例 4 ' Declare marCell and perDue as Integer variables. ' The phrase As Integer declares marCell as an Integer ' variable.The data type suffix % declares perDue as an ' Integer variable. Dim marCell As Integer, perDue% Print TypeName(marCell), TypeName(perDue%) ' Prints INTEGER INTEGER
例 5 Dim marCell% As Integer ' Error, because the Dim statement attempts to declare ' the Integer variable marCell using both the data type ' suffix character for Integer, and the data type name ' Integer.The declaration should include one or the ' other, but not both.
例 6 ' A data type suffix character is optional in references to a ' declared variable. ' Declare marCell as an Integer variable. Dim marCell As Integer ' Use the data type suffix character in a reference to marCell. marCell% = 1 ' Refer to marCell without using the suffix character. Print marCell ' Prints 1
例 7 ' Declare marCell as an Integer variable. Dim marCell As Integer ' Assign integer value to marCell. marCell% = 1 Print marCell$ ' Error, because the Print statement refers to marCell ' using the data type suffix character $ for a String ' variable, but marCell was declared as an Integer.
例 8 Dim db As New NotesDatabase ("Server003", "discuss.nsf")
この Dim objRef As New prodClass(argList) ステートメントは、Notes/Domino の NotesDatabase クラスへのオブジェクト参照を宣言し、そのインスタンスを作成します。NotesDomino のオブジェクトを作成する Dim ステートメントには、サーバー名とデータベースパス名という 2 つの文字列引数が必要です。
関連項目