2009年9月21日月曜日

super

Pythonにおいて継承した親クラスを明示する方法はJavaと同様、キーワード"super"を使用します。
例)Python

class Employee(Person):
def __init__(self):
super.__init__(self) # 親クラスの初期化メソッドを呼び出し。
例)Java

public class Employee extends Person {

public Employee() {
super(); // 親クラスのコンストラクタ呼び出し。
}
}

0 件のコメント:

コメントを投稿