ページへ戻る

− Links

 印刷 

Python​/クラス定義 のバックアップ差分(No.1) :: NJF Wiki

xpwiki:Python/クラス定義 のバックアップ差分(No.1)

  Next »[4]
1: 2017-01-07 (土) 05:49:15 njf[5] ソース[6] バックアップ No.1 を復元して編集[7]
Line 1: Line 1:
 +*基本 [#u61fc2c4]
 +クラスの定義は「class」で行います。
 +コンストラクタは「__init__」で、インスタンス化に「new」は不要です。
 +
 + class TestClass:
 +     def __init__(self):
 +         print "construct!"
 +
 + testClass = TestClass()
 +
 +結果
 + construct!
  Next »[4]