Rational Developer for System z
COBOL for Windows バージョン 7.5 プログラミング・ガイド


例: クライアントの定義

次の例では、Account クラスの小さいクライアント・プログラムを 示します。

プログラムは以下を実行します。

(Account クラスは、例: メソッドの定義で示しました。)

 cbl thread,pgmname(longmixed)
 Identification division.
 Program-id. “TestAccounts” recursive.
 Environment division.
 Configuration section.
 Repository.
     Class Account is “Account”.
 Data Division.
*  Working data is declared in LOCAL-STORAGE instead of 
*  WORKING-STORAGE so that each thread has its own copy: 
 Local-storage section.
 01  anAccount usage object reference Account.
*
 Procedure division.
 Test-Account-section.
     Display “Test Account class”
*  Create account 123456 with 0 balance:
     Invoke Account “createAccount”
       using by value 123456
       returning anAccount
*  Deposit 500 to the account: 
     Invoke anAccount “credit” using by value 500
     Invoke anAccount “print”
     Display space
*
     Stop Run.
 End program “TestAccounts”.

例: ファクトリーの定義 (メソッドに関して)

関連タスク
ファクトリー・メソッドの定義
ファクトリー・メソッドまたは静的メソッドの呼び出し
オブジェクト指向アプリケーションのコンパイル、リンク、および実行


ご利用条件 | フィードバック

Copyright IBM Corporation 1996, 2008.
このインフォメーション・センターでは Eclipse テクノロジーが採用されています。(http://www.eclipse.org)