May 4, 2025
チャイルドクラスの作成
class Child:def __init__(self):def say_hello(self): print("Hello")JapaneseChildクラスの作成(継承)
class JapaneseChild(Child):pass(何も処理をしない)japanese_child = JapaneseChild()Childクラスのsay_helloメソッドを利用def say_ohayou(self): print("おはよう")say_helloとsay_ohayouの両メソッドを利用この講義でクラスの基礎を学び、次回でPython入門を完結予定。